Skip to content

Commit ca19526

Browse files
authored
Enhance workflow permissions and update publishing method
Updated GitHub Actions workflow to include permissions for contents, pull-requests, and id-token. Changed publishing steps to use npm instead of bun.
1 parent cf3b50d commit ca19526

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/sc.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ concurrency:
1313
jobs:
1414
check:
1515
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
id-token: write
1620
steps:
1721
- name: Checkout
1822
uses: actions/checkout@v5
@@ -44,7 +48,7 @@ jobs:
4448
git commit -m "chore: update package version"
4549
git push
4650
47-
# Create pr
51+
# Create pr
4852
- uses: changepacks/action@main
4953
if: steps.new-size.outputs.new != steps.prev-size.outputs.prev
5054

@@ -65,7 +69,17 @@ jobs:
6569
- uses: changepacks/action@main
6670
if: steps.new-size.outputs.new != steps.prev-size.outputs.prev
6771

68-
- run: bun publish --access public --ignore-scripts
72+
# npm (not bun) does the actual publish: bun cannot perform the npm OIDC
73+
# token exchange. Trusted Publishing needs npm >= 11.5.1.
74+
- uses: actions/setup-node@v6
75+
if: steps.new-size.outputs.new != steps.prev-size.outputs.prev
76+
with:
77+
node-version: "24"
78+
registry-url: "https://registry.npmjs.org"
79+
80+
- name: Ensure npm >= 11.5.1 (OIDC Trusted Publishing)
81+
if: steps.new-size.outputs.new != steps.prev-size.outputs.prev
82+
run: npm install -g npm@latest
83+
84+
- run: npm publish --access public --ignore-scripts
6985
if: steps.new-size.outputs.new != steps.prev-size.outputs.prev
70-
env:
71-
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)