Skip to content

Commit dee02e6

Browse files
authored
Merge pull request #1567 from LemmyNet/include-commit-in-version
For untagged commits, include hash in version name (fixes #1563)
2 parents 198f307 + b7d1d91 commit dee02e6

7 files changed

Lines changed: 5 additions & 8 deletions

File tree

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ docker
44
api_tests
55
ansible
66
tests
7-
.git
87
*.sh

crates/utils/src/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pub const VERSION: &str = "0.10.3";
1+
pub const VERSION: &str = "unknown version";

docker/dev/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ COPY --from=cacher /home/rust/.cargo /home/rust/.cargo
3636
COPY ./ ./
3737

3838
RUN sudo chown -R rust:rust .
39+
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
3940
RUN cargo build
4041

4142
# reduce binary size

docker/dev/volume_mount.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ WORKDIR /app
99

1010
# Copy the source folders
1111
COPY . ./
12+
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
1213

1314
# Build for debug
1415
RUN --mount=type=cache,target=/usr/local/cargo/registry \

docker/prod/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ WORKDIR /app
99
COPY ./ ./
1010

1111
RUN sudo chown -R rust:rust .
12+
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
1213
RUN cargo build --release
1314

1415
# reduce binary size

docker/prod/Dockerfile.arm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update \
1111
WORKDIR /app
1212

1313
COPY ./ ./
14+
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
1415

1516
RUN cargo build --release
1617

docker/prod/deploy.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ set -e
66
new_tag="$1"
77
third_semver=$(echo $new_tag | cut -d "." -f 3)
88

9-
# Setting the version on the backend
10-
pushd ../../
11-
echo "pub const VERSION: &str = \"$new_tag\";" > "crates/utils/src/version.rs"
12-
git add "crates/utils/src/version.rs"
13-
popd
14-
159
# The ansible and docker installs should only update for non release-candidates
1610
# IE, when the third semver is a number, not '2-rc'
1711
if [ ! -z "${third_semver##*[!0-9]*}" ]; then

0 commit comments

Comments
 (0)