From f4b38e1c69d3a1f288ddba1b62ae84ae4184d362 Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 25 Feb 2025 02:20:35 +0100 Subject: [PATCH] CI: use dunamai for version --- .forgejo/workflows/build.yaml | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index c58230e..9f21750 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -30,32 +30,29 @@ jobs: - name: Get version uses: mtkennerly/dunamai-action@v1 with: - env-var: VERSION args: --style semver + env-var: VERSION - name: Version run: echo $VERSION - - name: Get version with git describe - id: version - run: | - echo "version=$(git describe)" >> $GITHUB_OUTPUT - echo "$VERSION" + - name: Get distance from tag + uses: mtkennerly/dunamai-action@v1 + with: + args: --format "{distance}" + env-var: DISTANCE - - name: Check if the container should be built + - name: Distance + run: echo $DISTANCE + + - name: Check if the container should be built (distance from git tag is 0, or force build) id: builder env: - RUN: ${{ toJSON(inputs.build || !contains(steps.version.outputs.version, '-')) }} + RUN: ${{ toJSON(inputs.build || env.DISTANCE == "0" }} run: | echo "run=$RUN" >> $GITHUB_OUTPUT echo "Run build: $RUN" - - name: Set the version in pyproject.toml (workaround for uv not supporting dynamic version) - if: fromJSON(steps.builder.outputs.run) - env: - VERSION: ${{ steps.version.outputs.version }} - run: sed "s/0.0.0/$VERSION/" -i pyproject.toml - - name: Workaround for bug of podman-login if: fromJSON(steps.builder.outputs.run) run: |