-
Notifications
You must be signed in to change notification settings - Fork 199
55 lines (48 loc) · 1.7 KB
/
npm-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
48
49
50
51
52
53
54
55
name: Publish Packages to NPM
on:
push:
branches:
- production
paths:
- 'packages/sdk/**'
jobs:
publishable-packages:
name: Check for package that can be published
uses: ./.github/workflows/publishable-packages.yml
with:
package-names: 'sdk'
publish-sdk:
name: Publish NPM
needs: publishable-packages
if: ${{ fromJson(needs.publishable-packages.outputs.publishable-packages)[0] != '' }}
runs-on: ubuntu-latest
# Required for provenance
permissions:
id-token: write
strategy:
matrix:
package-name: ${{ fromJson(needs.publishable-packages.outputs.publishable-packages) }}
steps:
- name: Checkout code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b
- name: Setup workflow
uses: ./.github/actions/setup
- name: Get pnpm store directory
id: pnpm-store
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
with:
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install and build package
run: |
pnpm --filter-prod ${{ matrix.package-name }}... install
pnpm --filter ${{ matrix.package-name }}... build
- name: Publish package
run: NPM_CONFIG_PROVENANCE=true pnpm --filter ${{ matrix.package-name }} publish --publish-branch production --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}