Skip to content

Commit fdc8c75

Browse files
authored
ci: migrate npm publish to staged publishing (#38)
1 parent c85c7a1 commit fdc8c75

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

.github/workflows/shipjs-trigger.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,35 @@ jobs:
99
runs-on: ubuntu-latest
1010
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v')
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
with:
1414
fetch-depth: 0
1515
ref: main
16-
- uses: actions/setup-node@v2
16+
- uses: actions/setup-node@v4
1717
with:
1818
registry-url: "https://registry.npmjs.org"
19-
node-version: '16'
19+
node-version: '24'
20+
- name: Pin npm with staged publishing support
21+
run: npm install -g npm@">=11.15.0"
2022
- run: yarn install --frozen-lockfile
2123
- run: npx shipjs trigger
2224
env:
2325
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2426
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
2527
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }}
28+
- name: Read package metadata
29+
id: pkg
30+
run: |
31+
{
32+
echo "name=$(node -p "require('./package.json').name")"
33+
echo "version=$(node -p "require('./package.json').version")"
34+
} >> "$GITHUB_OUTPUT"
35+
- name: Notify Slack about staged release
36+
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
37+
env:
38+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
39+
with:
40+
channel-id: ${{ secrets.SLACK_NPM_RELEASE_CHANNEL }}
41+
slack-message: |
42+
:package: *${{ steps.pkg.outputs.name }}@${{ steps.pkg.outputs.version }}* staged for review
43+
Review & approve (2FA required): https://www.npmjs.com/package/${{ steps.pkg.outputs.name }}?activeTab=staged

ship.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
module.exports = {
2-
publishCommand: ({ defaultCommand, tag }) =>
3-
`${defaultCommand} --access public --tag ${tag}`
2+
publishCommand: ({ tag }) => `npm stage publish --tag ${tag}`
43
};

0 commit comments

Comments
 (0)