diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index dd8086f..96c9883 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -10,6 +10,7 @@ concurrency: permissions: contents: write + actions: write jobs: tag: @@ -30,14 +31,29 @@ jobs: echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT" - name: Tag if new + id: tagstep run: | TAG="${{ steps.pkg.outputs.tag }}" if git rev-parse "refs/tags/${TAG}" >/dev/null 2>&1; then echo "::notice::Tag ${TAG} already exists; nothing to do." + echo "created=false" >> "$GITHUB_OUTPUT" exit 0 fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git tag -a "${TAG}" -m "Release ${TAG}" git push origin "${TAG}" - echo "::notice::Created and pushed tag ${TAG} — Release workflow will take over." + echo "created=true" >> "$GITHUB_OUTPUT" + echo "::notice::Created and pushed tag ${TAG}." + + # A tag pushed with GITHUB_TOKEN does NOT fire the Release workflow's + # `on: push: tags` trigger (GitHub blocks recursive event triggering). + # Dispatch it explicitly instead — workflow_dispatch via the API is not + # subject to that restriction (needs `actions: write`). + - name: Trigger Release workflow + if: steps.tagstep.outputs.created == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh workflow run release.yml -f tag="${{ steps.pkg.outputs.tag }}" + echo "::notice::Dispatched Release workflow for ${{ steps.pkg.outputs.tag }}." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6dcc7d4..dc00fbd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,9 @@ jobs: - name: Resolve tag id: tag run: | - TAG="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}" + # On workflow_dispatch, github.ref_name is the branch (e.g. master), + # so prefer the explicit input; on a tag push, ref_name is the tag. + TAG="${{ github.event.inputs.tag || github.ref_name }}" echo "tag=${TAG}" >> "$GITHUB_OUTPUT" - name: Verify version matches tag diff --git a/package-lock.json b/package-lock.json index 5a44c9b..7a8ccf0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "flaunt-github", - "version": "3.0.3", + "version": "3.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "flaunt-github", - "version": "3.0.3", + "version": "3.0.4", "license": "MIT", "dependencies": { "@octokit/rest": "^22.0.1", diff --git a/package.json b/package.json index 5685371..030a4b2 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "flaunt-github", "displayName": "Flaunt GitHub", "description": "Passively tracks coding activity and commits a rolling journal to a private GitHub repo. Dashboard, shareable profile badge, optional AI daily summaries.", - "version": "3.0.3", + "version": "3.0.4", "publisher": "UtkarshSingh", "icon": "images/logo.png", "license": "MIT",