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
63 changes: 63 additions & 0 deletions .github/workflows/auto-tag-release-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Auto Tag Release Merge

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

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

jobs:
tag:
if: >
github.event.pull_request.merged == true &&
(
startsWith(github.event.pull_request.head.ref, 'release/') ||
startsWith(github.event.pull_request.head.ref, 'hotfix/')
)
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout merged main commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24

- name: Create release tag from package version
env:
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
run: |
set -euo pipefail

version=$(node -p "require('./package.json').version")
tag="v${version}"

if [[ ! "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Derived invalid release tag: $tag"
exit 1
fi

git fetch --tags origin

if git show-ref --tags --verify --quiet "refs/tags/$tag"; then
echo "Tag $tag already exists; skipping."
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" "$MERGE_SHA" -m "Release $tag"
git push origin "$tag"
5 changes: 3 additions & 2 deletions docs/GITFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ TcTidier now follows a lightweight GitFlow model:
4. Open PRs from `feature/*` into `develop`.
5. Cut `release/<version>` from `develop` when the next release is ready.
6. On the release branch, update `CHANGELOG.md`, `package.json`, and any last release notes.
7. Merge the release branch into `main`, tag `v<version>`, then merge it back into `develop`.
8. For urgent production fixes, branch `hotfix/<version>` from `main`, merge back to `main`, tag, then back-merge into `develop`.
7. Merge the release branch into `main`; automation creates `v<version>` from the merged `main` commit, then open a `main` into `develop` PR for the back-merge.
8. For urgent production fixes, branch `hotfix/<version>` from `main`, merge back to `main`; automation creates the matching tag, then open a `main` into `develop` PR for the back-merge.

## Commands

Expand All @@ -48,6 +48,7 @@ git checkout -b hotfix/0.1.2
## Repo Automation

- CI runs on `main`, `develop`, `feature/*`, `release/*`, and `hotfix/*`.
- Merged `release/*` and `hotfix/*` PRs into `main` auto-create a matching `v*` tag when the version in `package.json` does not already have one.
- Tag pushes matching `v*` package the extension, publish the generated `.vsix` to a GitHub release, and can publish to extension registries when secrets are configured.
- Manual `workflow_dispatch` runs can re-publish an existing `v*` tag when a release needs to be retried after workflow fixes or secret changes.
- `npm run release:check` verifies the repo and creates a local `.vsix` package before a release PR or tag.
Expand Down
Loading