Drop 'latest' tag as a way of finding the newest tag

This commit is contained in:
Juno Takano 2026-03-11 02:02:46 -03:00
commit 1d5a7bad80
4 changed files with 37 additions and 31 deletions

View file

@ -165,22 +165,16 @@ alias oo := cover-open
# Tag HEAD with version from Cargo.toml # Tag HEAD with version from Cargo.toml
[script, group: 'assess'] [script, group: 'assess']
tag: update tag commit="HEAD": update
if [ "{{ last_tag }}" = "{{ manifest_version }}" ]; then if [ "{{ last_tag }}" = "{{ manifest_version }}" ]; then
echo "Last tag {{ last_tag }} and manifest ({{ manifest_version }}) already match" echo "Last tag {{ last_tag }} and manifest ({{ manifest_version }}) already match"
if [ "{{ last_tag }}" != "{{ tagged_latest }}" ]; then
echo "Last tag {{ last_tag }} and 'latest' tag ({{ tagged_latest }}) diverge"
git tag --force latest "v{{ manifest_version }}"
{{ just_cmd }} version-assess
fi
exit exit
elif [ "{{ manifest_version }}" != "{{ lockfile_version }}" ]; then elif [ "{{ manifest_version }}" != "{{ lockfile_version }}" ]; then
echo "Manifest and lockfile versions don't match: update failed?" echo "Manifest and lockfile versions don't match: update failed?"
exit 1 exit 1
fi fi
git tag "v{{ manifest_version }}" HEAD git tag "v{{ manifest_version }}" {{ commit }}
git tag --force latest "v{{ manifest_version }}"
{{ just_cmd }} version-assess {{ just_cmd }} version-assess
# Verify and push # Verify and push
@ -191,13 +185,6 @@ push: verify
alias p := push alias p := push
# Push tag 'latest'
[group: 'develop']
push-tag-latest-unsafe:
git push origin tag latest --force --no-verify
alias ptlu := push-tag-latest-unsafe
# Push without verifying # Push without verifying
[group: 'develop'] [group: 'develop']
push-unsafe: push-unsafe:
@ -306,15 +293,13 @@ alias v := verify
[script, group: 'assess'] [script, group: 'assess']
version-assess: update version-assess: update
if if
[ "{{ last_tag }}" != "{{ tagged_latest }}" ] \ [ "{{ last_tag }}" != "{{ lockfile_version }}" ] \
|| [ "{{ last_tag }}" != "{{ lockfile_version }}" ] \
|| [ "{{ last_tag }}" != "{{ lockfile_version }}" ] || [ "{{ last_tag }}" != "{{ lockfile_version }}" ]
then then
printf 'Last tag: %s\nManifest: %s\nLockfile: %s\nTagged latest: %s\n' \ printf 'Last tag: %s\nManifest: %s\nLockfile: %s\n' \
"{{ last_tag }}" \ "{{ last_tag }}" \
"{{ manifest_version }}" \ "{{ manifest_version }}" \
"{{ lockfile_version }}" \ "{{ lockfile_version }}"
"{{ tagged_latest }}"
exit 1 exit 1
fi fi
@ -413,12 +398,7 @@ watch_cmd := "watchexec -qc -r -e rs,toml,html --color always -- "
cover_cmd := 'cargo llvm-cov --color always --ignore-filename-regex "main\.rs|log\.rs"' cover_cmd := 'cargo llvm-cov --color always --ignore-filename-regex "main\.rs|log\.rs"'
just_cmd := 'just --timestamp --explain --command-color green' just_cmd := 'just --timestamp --explain --command-color green'
last_tag := ``` last_tag := `git tag --sort=-creatordate | head -1 | tr -d v`
git tag --sort=-creatordate \
| grep -v '^latest$' | head -1 | tr -d v
```
tagged_latest := `git tag --points-at $(git rev-parse latest) \
| grep -v '^latest$' | tr -d v`
manifest_version := `grep "^version" Cargo.toml | cut -d \" -f 2` manifest_version := `grep "^version" Cargo.toml | cut -d \" -f 2`
lockfile_version := ``` lockfile_version := ```
grep -A 1 'name = "en"' Cargo.lock \ grep -A 1 'name = "en"' Cargo.lock \

View file

@ -1,14 +1,27 @@
FROM alpine:latest FROM alpine:latest
MAINTAINER Juno Takano juno@jutty.dev MAINTAINER Juno Takano juno@jutty.dev
ENV DEBUG=debug ENV DEBUG=debug
ENV TAG=${TAG:-latest}
# Setup tooling # Setup tooling
RUN apk add curl clang git file RUN apk add curl clang git file
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Install # Install
RUN git clone -b "$TAG" --single-branch https://codeberg.org/jutty/en /build RUN <<EOF
REPO_URL=https://codeberg.org/jutty/en
LAST_TAG=$(
git ls-remote --tags "$REPO_URL" \
| grep refs/tags \
| sed 's/.*refs\/tags\///' \
| sort -V \
| tail -n 1
)
git config --global advice.detachedHead false
echo "Selected tag: $LAST_TAG"
git clone --verbose -b "$LAST_TAG" \
--depth 1 --single-branch --no-tags \
"$REPO_URL" /build
EOF
RUN <<EOF RUN <<EOF
cd /build && /root/.cargo/bin/cargo build --locked --release cd /build && /root/.cargo/bin/cargo build --locked --release
mv /build/target/release/en /usr/local/bin/en mv /build/target/release/en /usr/local/bin/en

View file

@ -1,7 +1,6 @@
FROM debian:stable-slim FROM debian:stable-slim
MAINTAINER Juno Takano juno@jutty.dev MAINTAINER Juno Takano juno@jutty.dev
ENV DEBUG=debug ENV DEBUG=debug
ENV TAG=${TAG:-latest}
# Setup tooling # Setup tooling
RUN apt-get -y --update install --no-install-recommends \ RUN apt-get -y --update install --no-install-recommends \
@ -9,7 +8,21 @@ RUN apt-get -y --update install --no-install-recommends \
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
# Install # Install
RUN git clone -b "$TAG" --single-branch https://codeberg.org/jutty/en /build RUN <<EOF
REPO_URL=https://codeberg.org/jutty/en
LAST_TAG=$(
git ls-remote --tags "$REPO_URL" \
| grep refs/tags \
| sed 's/.*refs\/tags\///' \
| sort -V \
| tail -n 1
)
git config --global advice.detachedHead false
echo "Selected tag: $LAST_TAG"
git clone --verbose -b "$LAST_TAG" \
--depth 1 --single-branch --no-tags \
"$REPO_URL" /build
EOF
RUN <<EOF RUN <<EOF
cd /build && /root/.cargo/bin/cargo build --locked --release cd /build && /root/.cargo/bin/cargo build --locked --release
mv /build/target/release/en /usr/local/bin/en mv /build/target/release/en /usr/local/bin/en

View file

@ -37,7 +37,7 @@ cargo install --git https://codeberg.org/jutty/en --tag v{{ en_version }}
And you should now have the `en` command available on your shell. And you should now have the `en` command available on your shell.
The `cargo install` example shown above will build en from the latest tagged release, which should be more stable. You can remove the `--tag v{{ en_version }}` part if you'd like to build the very latest development sources. The `cargo install` example shown above will build en from the last tagged release, which should be more stable. You can remove the `--tag v{{ en_version }}` part if you'd like to build the most recent development sources.
For more details on building from source, see |SourceBuild|. For more details on building from source, see |SourceBuild|.