Skip to content

Commit 29b39ad

Browse files
committed
chore(ci): merge publish into release workflow
GITHUB_TOKEN tag pushes don't trigger other workflows, so the separate publish.yml never ran. Move npm publish and GitHub Release creation into the release workflow after the tag push step.
1 parent 2062acd commit 29b39ad

2 files changed

Lines changed: 26 additions & 47 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66

77
permissions:
88
contents: write
9+
id-token: write
910

1011
jobs:
1112
release:
@@ -43,6 +44,17 @@ jobs:
4344
uses: actions/setup-node@v5
4445
with:
4546
node-version-file: .nvmrc
47+
cache: 'npm'
48+
cache-dependency-path: package-lock.json
49+
registry-url: 'https://registry.npmjs.org'
50+
51+
- name: Install dependencies
52+
if: steps.version.outputs.bump == 'true'
53+
run: npm ci --prefer-offline --no-audit --no-fund
54+
55+
- name: Build
56+
if: steps.version.outputs.bump == 'true'
57+
run: npm run build:only
4658

4759
- name: Bump package.json version
4860
if: steps.version.outputs.bump == 'true'
@@ -61,3 +73,17 @@ jobs:
6173
git commit -m "chore(release): ${{ steps.version.outputs.version }}"
6274
git tag -a "${{ steps.version.outputs.version }}" -m "${{ steps.version.outputs.version }}"
6375
git push origin main --follow-tags
76+
77+
- name: Publish to npm
78+
if: steps.version.outputs.bump == 'true'
79+
run: npm publish --provenance --access public
80+
81+
- name: Generate release notes
82+
if: steps.version.outputs.bump == 'true'
83+
run: git-cliff --latest --strip header > RELEASE_NOTES.md
84+
85+
- name: Create GitHub Release
86+
if: steps.version.outputs.bump == 'true'
87+
run: gh release create "${{ steps.version.outputs.version }}" --title "${{ steps.version.outputs.version }}" --notes-file RELEASE_NOTES.md
88+
env:
89+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)