Auto-create version tags from tauri.conf.json on main push
Some checks failed
Build / check-version (push) Successful in 7s
Build / create-tag (push) Successful in 7s
Build / build-linux (push) Successful in 9m23s
Build / build-windows (push) Successful in 6m42s
Build / create-release (push) Has been cancelled
Build / build-android (push) Has been cancelled

This commit is contained in:
2026-01-24 04:26:34 +11:00
parent 82a3cb9674
commit 70d29bf4d3

View File

@@ -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