Merge pull request #1567 from LemmyNet/include-commit-in-version

For untagged commits, include hash in version name (fixes #1563)
This commit is contained in:
Dessalines 2021-04-12 11:40:43 -04:00 committed by GitHub
commit dee02e6642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 5 additions and 8 deletions

View File

@ -4,5 +4,4 @@ docker
api_tests
ansible
tests
.git
*.sh

View File

@ -1 +1 @@
pub const VERSION: &str = "0.10.3";
pub const VERSION: &str = "unknown version";

View File

@ -36,6 +36,7 @@ COPY --from=cacher /home/rust/.cargo /home/rust/.cargo
COPY ./ ./
RUN sudo chown -R rust:rust .
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
RUN cargo build
# reduce binary size

View File

@ -9,6 +9,7 @@ WORKDIR /app
# Copy the source folders
COPY . ./
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
# Build for debug
RUN --mount=type=cache,target=/usr/local/cargo/registry \

View File

@ -9,6 +9,7 @@ WORKDIR /app
COPY ./ ./
RUN sudo chown -R rust:rust .
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
RUN cargo build --release
# reduce binary size

View File

@ -11,6 +11,7 @@ RUN apt-get update \
WORKDIR /app
COPY ./ ./
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
RUN cargo build --release

View File

@ -6,12 +6,6 @@ set -e
new_tag="$1"
third_semver=$(echo $new_tag | cut -d "." -f 3)
# Setting the version on the backend
pushd ../../
echo "pub const VERSION: &str = \"$new_tag\";" > "crates/utils/src/version.rs"
git add "crates/utils/src/version.rs"
popd
# The ansible and docker installs should only update for non release-candidates
# IE, when the third semver is a number, not '2-rc'
if [ ! -z "${third_semver##*[!0-9]*}" ]; then