From: Felix Ableitner Date: Mon, 12 Apr 2021 11:47:58 +0000 (+0200) Subject: For untagged commits, include hash in version name (fixes #1563) X-Git-Url: http://these/git/%24%7BgetStaticDir%28%29%7D/styles/static/README.zh.hant.md?a=commitdiff_plain;h=b7d1d91309cbf815f73a576bf236e5994057f1a4;p=lemmy.git For untagged commits, include hash in version name (fixes #1563) --- diff --git a/.dockerignore b/.dockerignore index 3a0f82b4..b3bb4eb2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,5 +4,4 @@ docker api_tests ansible tests -.git *.sh diff --git a/crates/utils/src/version.rs b/crates/utils/src/version.rs index 397d2a42..ac0896a3 100644 --- a/crates/utils/src/version.rs +++ b/crates/utils/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "0.10.3"; +pub const VERSION: &str = "unknown version"; diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index 5d2acec7..4b7dc3ad 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -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 diff --git a/docker/dev/volume_mount.dockerfile b/docker/dev/volume_mount.dockerfile index 00d9c473..6d9fa996 100644 --- a/docker/dev/volume_mount.dockerfile +++ b/docker/dev/volume_mount.dockerfile @@ -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 \ diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile index 75c53e67..b869a766 100644 --- a/docker/prod/Dockerfile +++ b/docker/prod/Dockerfile @@ -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 diff --git a/docker/prod/Dockerfile.arm b/docker/prod/Dockerfile.arm index b3eacb4f..01f24456 100644 --- a/docker/prod/Dockerfile.arm +++ b/docker/prod/Dockerfile.arm @@ -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 diff --git a/docker/prod/deploy.sh b/docker/prod/deploy.sh index 7520f149..d72a74e8 100755 --- a/docker/prod/deploy.sh +++ b/docker/prod/deploy.sh @@ -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