Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,24 @@ on:
paths:
- 'package.json'

# Uses the built-in GITHUB_TOKEN, so there is no PAT to expire. A tag
# pushed with GITHUB_TOKEN doesn't trigger other workflows, so this
# dispatches the publish workflow on the new tag explicitly
# (workflow_dispatch is exempt from that rule).
jobs:
tag:
# Only tag main. The default branch is develop, so a manual dispatch
# without --ref main would otherwise tag develop.
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}

- name: Get version from package.json
id: version
Expand All @@ -44,6 +51,12 @@ jobs:
git tag -a "${{ steps.version.outputs.tag }}" -m "Release ${{ steps.version.outputs.tag }}"
git push origin "${{ steps.version.outputs.tag }}"

- name: Trigger publish
if: steps.check_tag.outputs.exists == 'false'
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run publish.yml --repo "${{ github.repository }}" --ref "${{ steps.version.outputs.tag }}"

- name: Tag already exists
if: steps.check_tag.outputs.exists == 'true'
run: echo "Tag ${{ steps.version.outputs.tag }} already exists, skipping"
Loading