-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (46 loc) · 1.47 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Publish
permissions:
id-token: write
on:
workflow_call:
inputs:
package:
required: true
type: string
secrets:
NPM_TOKEN:
required: true
SLACK_TOKEN:
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v4
with:
version: 9
- run: pnpm install
- run: pnpm build ${{ inputs.package }}
- run: cp README.md packages/${{ inputs.package }}
if: ${{ inputs.package == 'core' }}
- run: pnpm publish --provenance --no-git-checks
working-directory: packages/${{ inputs.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- id: package-id
working-directory: packages/${{ inputs.package }}
run: |
packageId=$(cat package.json | jq -r '.name')
echo "packageId=$packageId" >> "$GITHUB_OUTPUT"
- uses: slackapi/slack-github-action@v1
with:
channel-id: ${{ vars.PUBLISHED_SLACK_CHANNEL_ID }}
# For posting a simple plain text message
slack-message: "Published ${{ steps.package-id.outputs.packageId }}@${{ github.ref_name }} to NPM: https://npmjs.com/package/${{ steps.package-id.outputs.packageId }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}