From fefe44acfef0a16c492070ac8bc9f43d4637aa2c Mon Sep 17 00:00:00 2001
From: phil <phil.dev@philome.mooo.com>
Date: Tue, 4 Feb 2025 03:03:28 +0100
Subject: [PATCH] CI: build only if git clean tag

---
 .forgejo/workflows/build.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml
index df52e0b..e02bf47 100644
--- a/.forgejo/workflows/build.yaml
+++ b/.forgejo/workflows/build.yaml
@@ -48,11 +48,13 @@ jobs:
         run: sed "s/0.0.0/$VERSION/" -i pyproject.toml
 
       - name: Workaround for bug of podman-login
+        if: fromJSON(steps.builder.outputs.run)
         run: |
           mkdir -p $HOME/.docker
           echo "{ \"auths\": {} }" > $HOME/.docker/config.json
 
       - name: Log in to the container registry (with another workaround)
+        if: fromJSON(steps.builder.outputs.run)
         uses: actions/podman-login@v1
         with:
           registry: ${{ vars.REGISTRY }}
@@ -61,6 +63,7 @@ jobs:
           auth_file_path: /tmp/auth.json
 
       - name: Build the container image
+        if: fromJSON(steps.builder.outputs.run)
         uses: actions/buildah-build@v1
         with:
           image: oidc-fastapi-test
@@ -71,6 +74,7 @@ jobs:
             ./Containerfile
 
       - name: Push the image to the registry
+        if: fromJSON(steps.builder.outputs.run)
         uses: actions/push-to-registry@v2
         with:
           registry: "docker://${{ vars.REGISTRY }}/${{ vars.ORGANISATION }}"
@@ -78,9 +82,11 @@ jobs:
           tags: latest ${{ steps.version.outputs.version }}
 
       - name: Build wheel
+        if: fromJSON(steps.builder.outputs.run)
         run: uv build --wheel
 
       - name: Publish Python package (home)
+        if: fromJSON(steps.builder.outputs.run)
         env:
           LOCAL_PYPI_TOKEN: ${{ secrets.LOCAL_PYPI_TOKEN }}
         run: uv publish --publish-url https://code.philo.ydns.eu/api/packages/philorg/pypi --token $LOCAL_PYPI_TOKEN