Skip to content

Commit 115d3fd

Browse files
committed
ci: collapse release and publish into one workflow to avoid GITHUB_TOKEN cross-trigger restriction
GITHUB_TOKEN cannot trigger downstream workflows by design. Splitting release-please and npm publish across two workflows (tag push -> publish) was always broken. Single workflow: release job runs release-please on push to main; publish job runs in the same workflow run when release_created is true, so no cross-trigger is needed.
1 parent fa4b31b commit 115d3fd

2 files changed

Lines changed: 37 additions & 65 deletions

File tree

.github/workflows/publish.yml

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

.github/workflows/release.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,58 @@
11
name: Release
22

33
on:
4-
workflow_run:
5-
workflows: ["CI"]
6-
types: [completed]
7-
branches: [main]
4+
push:
5+
branches: ["main"]
86

97
jobs:
108
release:
119
name: Release
1210
runs-on: ubuntu-latest
13-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1411

1512
permissions:
1613
contents: write
1714

15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
1819
steps:
1920
- uses: actions/checkout@v6
2021

2122
- uses: googleapis/release-please-action@v4
23+
id: release
2224
with:
2325
token: ${{ secrets.GITHUB_TOKEN }}
2426
config-file: release-config.json
2527
manifest-file: .release-manifest.json
2628
skip-github-pull-request: true
29+
30+
publish:
31+
name: Publish to npm
32+
runs-on: ubuntu-latest
33+
needs: release
34+
if: ${{ needs.release.outputs.release_created == 'true' }}
35+
36+
permissions:
37+
contents: read
38+
id-token: write
39+
40+
steps:
41+
- uses: actions/checkout@v6
42+
with:
43+
ref: ${{ needs.release.outputs.tag_name }}
44+
45+
- name: Set up Node.js
46+
uses: actions/setup-node@v6
47+
with:
48+
node-version: "22.14"
49+
registry-url: "https://registry.npmjs.org"
50+
cache: "npm"
51+
52+
- name: Install dependencies
53+
run: npm ci
54+
55+
- name: Publish
56+
run: npm publish --access public
57+
env:
58+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)