From 70d29bf4d3bb0cfbf92c8dc4605d7b6b7ee5321d Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Sat, 24 Jan 2026 04:26:34 +1100 Subject: [PATCH] Auto-create version tags from tauri.conf.json on main push --- .gitea/workflows/build.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index a8d5ecc..171b814 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -12,6 +12,48 @@ env: TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} jobs: + check-version: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') + outputs: + should_release: ${{ steps.check.outputs.should_release }} + version: ${{ steps.check.outputs.version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if version tag exists + id: check + run: | + VERSION=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1) + echo "version=$VERSION" >> $GITHUB_OUTPUT + if git rev-parse "v$VERSION" >/dev/null 2>&1; then + echo "Tag v$VERSION already exists" + echo "should_release=false" >> $GITHUB_OUTPUT + else + echo "Tag v$VERSION does not exist, will create release" + echo "should_release=true" >> $GITHUB_OUTPUT + fi + + create-tag: + runs-on: ubuntu-latest + needs: check-version + if: needs.check-version.outputs.should_release == 'true' + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Create and push tag + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git tag -a "v${{ needs.check-version.outputs.version }}" -m "Release v${{ needs.check-version.outputs.version }}" + git push origin "v${{ needs.check-version.outputs.version }}" + build-windows: runs-on: windows