From 11cdf0acf2ae6d51520913e246b89d3dd8c8552b Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Thu, 19 Feb 2026 18:34:01 +1100 Subject: [PATCH] refactor: remove version check job and streamline release process --- .gitea/workflows/build.yml | 86 +++++++++----------------------------- 1 file changed, 20 insertions(+), 66 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 700a971..c2ef328 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -15,60 +15,8 @@ env: RUSTUP_MAX_RETRIES: 10 jobs: - check-version: - runs-on: ubuntu-latest - if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && !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 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Check and increment version - id: check - run: | - # Get current version - VERSION=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1) - echo "Current version: $VERSION" - - # Check if tag exists - if git rev-parse "v$VERSION" >/dev/null 2>&1; then - echo "Tag v$VERSION already exists, incrementing patch version..." - - # Parse version components - IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" - NEW_PATCH=$((PATCH + 1)) - NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH" - - echo "New version: $NEW_VERSION" - - # Update tauri.conf.json - sed -i "s/\"version\": \"$VERSION\"/\"version\": \"$NEW_VERSION\"/" src-tauri/tauri.conf.json - - # Commit and push - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git add src-tauri/tauri.conf.json - git commit -m "chore: bump version to $NEW_VERSION [skip ci]" - git push - - echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - echo "should_release=true" >> $GITHUB_OUTPUT - else - echo "Tag v$VERSION does not exist, will create release" - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "should_release=true" >> $GITHUB_OUTPUT - fi - build-windows: runs-on: windows - needs: [check-version] - if: always() && (needs.check-version.result == 'success' || needs.check-version.result == 'skipped') steps: - name: Checkout repository @@ -138,8 +86,6 @@ jobs: build-linux: runs-on: ubuntu-latest - needs: [check-version] - if: always() && (needs.check-version.result == 'success' || needs.check-version.result == 'skipped') steps: - name: Checkout repository @@ -217,8 +163,6 @@ jobs: build-android: runs-on: windows - needs: [check-version] - if: always() && (needs.check-version.result == 'success' || needs.check-version.result == 'skipped') steps: - name: Checkout repository @@ -343,26 +287,36 @@ jobs: create-release: runs-on: ubuntu-latest - needs: [check-version, build-windows, build-linux, build-android] - if: always() && !cancelled() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success') && (startsWith(github.ref, 'refs/tags/v') || needs.check-version.outputs.should_release == 'true') + needs: [build-windows, build-linux, build-android] + if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success') steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Get version from tag or check-version + - name: Get version id: version run: | - if [[ "${{ github.ref }}" == refs/tags/v* ]]; then - VERSION="${{ github.ref_name }}" - VERSION="${VERSION#v}" - else - VERSION="${{ needs.check-version.outputs.version }}" - fi + VERSION=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1) echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Version: $VERSION" + + - name: Check if tag exists + id: tag_check + run: | + VERSION="${{ steps.version.outputs.VERSION }}" + if git rev-parse "v$VERSION" >/dev/null 2>&1; then + echo "Tag v$VERSION already exists" + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "Tag v$VERSION does not exist" + echo "exists=false" >> $GITHUB_OUTPUT + fi - name: Create and push tag - if: ${{ !startsWith(github.ref, 'refs/tags/') }} + if: steps.tag_check.outputs.exists == 'false' run: | git config user.name "GitHub Actions" git config user.email "actions@github.com"