From 6b63d54eb8d6cd7412a3fa61f88803cb9c1ff522 Mon Sep 17 00:00:00 2001 From: neru Date: Thu, 9 Apr 2026 06:41:13 -0300 Subject: [PATCH] build: modify tags, keep commits of failed runs --- .github/workflows/build.yml | 42 +++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eda81a2..452a84e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,36 +22,31 @@ jobs: if: ${{ github.event_name == 'push' }} shell: bash run: | - git fetch --tags || true + git fetch --tags --force - # Determine last tag and log range - if git describe --tags --abbrev=0 >/dev/null 2>&1; then - LAST_TAG=$(git describe --tags --abbrev=0) + if LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null); then RANGE="${LAST_TAG}..HEAD" else LAST_TAG="v0.1.9" RANGE="HEAD" fi - # Calculate next version IFS='.' read -r major minor patch <<< "${LAST_TAG#v}" NEW_VERSION="$major.$minor.$((patch + 1))" - NEW_TAG="v$NEW_VERSION" - # Log commits CHANGELOG=$(git log $RANGE --oneline | sed 's/^/* /') - [ -z "$CHANGELOG" ] && CHANGELOG="Maintenance build." + if [ -z "$CHANGELOG" ]; then + CHANGELOG="Re-run of version $NEW_VERSION or maintenance build." + fi - # Tag and push back to Gitea - git tag $NEW_TAG - git push origin $NEW_TAG - - # Set outputs for next steps echo "version-string=$NEW_VERSION" >> $GITHUB_OUTPUT - echo "changelog<> $GITHUB_OUTPUT - echo "## What's Changed" >> $GITHUB_OUTPUT - echo "$CHANGELOG" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + echo "new-tag=v$NEW_VERSION" >> $GITHUB_OUTPUT + { + echo "changelog<> $GITHUB_OUTPUT - name: Setup Tools Cache id: tools-cache @@ -124,11 +119,18 @@ jobs: name: unlocker-build path: unlocker.zip + - name: Finalize Version and Push Tag + if: ${{ github.event_name == 'push' && success() }} + run: | + git tag ${{ steps.calculate-version.outputs.new-tag }} + git push origin ${{ steps.calculate-version.outputs.new-tag }} + - name: Create Gitea Release - if: ${{ github.event_name == 'push' }} + if: ${{ github.event_name == 'push' && success() }} uses: akkuman/gitea-release-action@v1 with: files: unlocker.zip - tag_name: v${{ steps.calculate-version.outputs.version-string }} - name: Release v${{ steps.calculate-version.outputs.version-string }} + tag_name: ${{ steps.calculate-version.outputs.new-tag }} + name: Release ${{ steps.calculate-version.outputs.new-tag }} body: ${{ steps.calculate-version.outputs.changelog }} + \ No newline at end of file