Skip to content

Commit 61099ba

Browse files
committed
refactor(github): single workflow CI-driven release
Replace release-it (blocked by branch protection) with a workflow_dispatch release.yml that runs lint/typecheck/test, bumps version, generates the changelog, commits and tags directly to master via RELEASE_PAT (which must have bypass rights on the branch protection rule), creates a GitHub Release via actions/create-release with a prerelease toggle, then triggers deploy.yml. deploy.yml gains a skip guard so the release bump commit does not trigger a redundant deploy — release.yml dispatches deploy explicitly after tagging. Requires: RELEASE_PAT secret (classic PAT, repo scope) with bypass rights on the master branch protection rule.
1 parent 1bff442 commit 61099ba

3 files changed

Lines changed: 37 additions & 36 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ on:
1313
- 'package-lock.json'
1414

1515
workflow_dispatch:
16-
inputs:
17-
skip_checks:
18-
description: "Skip lint/test (emergency deploy)"
19-
required: false
20-
default: "false"
21-
type: choice
22-
options: ["false", "true"]
2316

2417
permissions:
2518
contents: read
@@ -35,7 +28,7 @@ env:
3528

3629
jobs:
3730
deploy:
38-
# Skip when the push is a release bump commit — publish.yml owns that deploy
31+
# release.yml triggers this explicitly after tagging; skip the push event
3932
if: |
4033
github.event_name == 'workflow_dispatch' ||
4134
!startsWith(github.event.head_commit.message, 'chore(release):')
@@ -46,29 +39,26 @@ jobs:
4639
url: ${{ steps.deployment.outputs.page_url }}
4740

4841
steps:
49-
- uses: actions/checkout@v4
42+
- uses: actions/checkout@v6
5043
with:
5144
fetch-depth: 0
5245

53-
- uses: actions/setup-node@v4
46+
- uses: actions/setup-node@v6
5447
with:
55-
node-version: 22
48+
node-version: 24
5649
cache: npm
5750
cache-dependency-path: package-lock.json
5851

5952
- name: Install deps
6053
run: npm ci --legacy-peer-deps
6154

6255
- name: Lint
63-
if: inputs.skip_checks != 'true'
6456
run: npm run lint
6557

6658
- name: Test
67-
if: inputs.skip_checks != 'true'
6859
run: npm run test
6960

7061
- name: Type-check
71-
if: inputs.skip_checks != 'true'
7262
run: npm run typecheck
7363

7464
- name: Build

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v6
2626
with:
2727
fetch-depth: 0
2828
token: ${{ secrets.RELEASE_PAT }}

.github/workflows/release.yml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,59 @@ on:
44
workflow_dispatch:
55
inputs:
66
bump:
7-
description: "Version bump type"
7+
description: "Version bump"
88
required: true
99
default: patch
1010
type: choice
1111
options: [patch, minor, major]
12+
prerelease:
13+
description: "Pre-release"
14+
required: false
15+
default: "false"
16+
type: choice
17+
options: ["false", "true"]
1218

1319
concurrency:
1420
group: release
1521
cancel-in-progress: false
1622

1723
permissions:
1824
contents: write
19-
pull-requests: write
25+
26+
env:
27+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
2028

2129
jobs:
22-
open-release-pr:
30+
release:
2331
runs-on: ubuntu-latest
2432

2533
steps:
26-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@v6
2735
with:
2836
fetch-depth: 0
2937
token: ${{ secrets.RELEASE_PAT }}
3038

31-
- uses: actions/setup-node@v4
39+
- uses: actions/setup-node@v6
3240
with:
3341
node-version: 22
3442
cache: npm
43+
cache-dependency-path: package-lock.json
3544

3645
- name: Install deps
3746
run: npm ci --legacy-peer-deps
3847

39-
- name: Lint and test
48+
- name: Lint, typecheck, test
4049
run: |
4150
npm run lint
51+
npm run typecheck
4252
npm run test
4353
4454
- name: Configure git
4555
run: |
4656
git config user.name "Vladimir Kirov"
4757
git config user.email "morbeo@gmail.com"
4858
49-
- name: Bump version (no commit, no tag)
59+
- name: Bump version
5060
id: bump
5161
run: |
5262
VERSION=$(npm version ${{ inputs.bump }} --no-git-tag-version)
@@ -55,23 +65,24 @@ jobs:
5565
- name: Generate changelog
5666
run: npx git-cliff --tag ${{ steps.bump.outputs.version }} -o CHANGELOG.md
5767

58-
- name: Commit and push release branch
68+
- name: Commit, tag, push
5969
run: |
60-
BRANCH="chore/release-${{ steps.bump.outputs.version }}"
61-
git checkout -b "$BRANCH"
6270
git add package.json package-lock.json CHANGELOG.md
6371
git commit -m "chore(release): ${{ steps.bump.outputs.version }}"
64-
git push origin "$BRANCH"
65-
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
66-
id: branch
72+
git tag ${{ steps.bump.outputs.version }}
73+
git push origin master --follow-tags
6774
68-
- name: Open PR
69-
run: |
70-
gh pr create \
71-
--title "chore(release): ${{ steps.bump.outputs.version }}" \
72-
--body "Automated release bump for ${{ steps.bump.outputs.version }}. Merging this PR will trigger the deploy workflow." \
73-
--base master \
74-
--head "${{ steps.branch.outputs.branch }}" \
75-
--label "release"
75+
- name: Create GitHub Release
76+
uses: actions/create-release@latest
77+
with:
78+
tag_name: ${{ steps.bump.outputs.version }}
79+
release_name: ${{ steps.bump.outputs.version }}
80+
body: ${{ steps.changelog.outputs.content }}
81+
prerelease: ${{ inputs.prerelease == 'true' }}
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }}
84+
85+
- name: Trigger deploy
86+
run: gh workflow run deploy.yml --ref master
7687
env:
7788
GH_TOKEN: ${{ secrets.RELEASE_PAT }}

0 commit comments

Comments
 (0)