Skip to content
Merged
Show file tree
Hide file tree
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
48 changes: 48 additions & 0 deletions .github/workflows/tag-on-release-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tag Release After Merge

on:
pull_request:
types:
- closed
branches:
- main

permissions:
contents: write

concurrency:
group: tag-release-${{ github.event.pull_request.number }}
cancel-in-progress: false

jobs:
create-tag:
name: Create Version Tag
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
steps:
- name: Checkout merged main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0

- name: Configure git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

- name: Create and push tag
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="v$VERSION"

# Ensure local tags are up to date before existence check.
git fetch --tags

if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping."
exit 0
fi

git tag "$TAG"
git push origin "$TAG"
17 changes: 7 additions & 10 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
workflow_dispatch:
inputs:
version_type:
description: "Version bump type"
description: 'Version bump type'
required: true
default: "patch"
default: 'patch'
type: choice
options:
- major
Expand All @@ -17,7 +17,7 @@ on:
- prepatch
- prerelease
prerelease_id:
description: "Prerelease identifier (only used for prerelease versions)"
description: 'Prerelease identifier (only used for prerelease versions)'
required: false
type: choice
options:
Expand Down Expand Up @@ -58,8 +58,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: "20"
cache: "pnpm"
node-version: '20'
cache: 'pnpm'

- name: Configure git
run: |
Expand Down Expand Up @@ -199,9 +199,6 @@ jobs:

echo "release_branch=$RELEASE_BRANCH" >> $GITHUB_OUTPUT

- name: Authenticate GitHub CLI
run: gh auth setup-git

- name: Create Pull Request
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -225,7 +222,7 @@ jobs:

### Next steps
1. Review and merge this PR
2. Create and push tag \`$NEW_VERSION\` from \`main\`
3. Publish workflow will run from tag push
2. Tag is created automatically after merge
3. Publish workflow runs from the tag push
EOF
)"
Loading