For untagged commits, include hash in version name (fixes #1563)

This commit is contained in:
Felix Ableitner 2021-04-12 13:47:58 +02:00
parent aa79c5131f
commit b7d1d91309
7 changed files with 5 additions and 8 deletions

View file

@ -4,5 +4,4 @@ docker
api_tests api_tests
ansible ansible
tests tests
.git
*.sh *.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 ./ ./ COPY ./ ./
RUN sudo chown -R rust:rust . RUN sudo chown -R rust:rust .
RUN echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
RUN cargo build RUN cargo build
# reduce binary size # reduce binary size

View file

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

View file

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

View file

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

View file

@ -6,12 +6,6 @@ set -e
new_tag="$1" new_tag="$1"
third_semver=$(echo $new_tag | cut -d "." -f 3) 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 # The ansible and docker installs should only update for non release-candidates
# IE, when the third semver is a number, not '2-rc' # IE, when the third semver is a number, not '2-rc'
if [ ! -z "${third_semver##*[!0-9]*}" ]; then if [ ! -z "${third_semver##*[!0-9]*}" ]; then