-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (67 loc) · 2.04 KB
/
release-publish.yaml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Release
on:
push:
branches:
- main
jobs:
test-and-build:
uses: ./.github/workflows/test-build.yaml
secrets: inherit
permissions:
contents: read
id-token: write
release:
name: Maintenance
runs-on: ubuntu-latest
needs: [test-and-build]
steps:
- uses: googleapis/release-please-action@v4
id: release-please
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- uses: actions/github-script@v7
id: get-released-pkgs
env:
PATHS_RELEASED: ${{ steps.release-please.outputs.paths_released }}
PUBLISHABLE_PKGS: ${{ vars.PUBLISHABLE_PKGS }}
with:
script: |
const { PATHS_RELEASED, PUBLISHABLE_PKGS } = process.env;
const paths = JSON.parse(PATHS_RELEASED);
const pubs = JSON.parse(PUBLISHABLE_PKGS);
const pkgs = paths.map(path => path.split('/').at(1));
return pkgs.filter(pkg => pubs.includes(pkg));
outputs:
pkgs-released: ${{ steps.get-released-pkgs.outputs.result }}
publish:
name: Publish
if: ${{ needs.release.outputs.pkgs-released != '[]' }}
runs-on: ubuntu-latest
needs: [release]
strategy:
matrix:
package: ${{ fromJson(needs.release.outputs.pkgs-released) }}
defaults:
run:
working-directory: packages/${{ matrix.package }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: ".bun-version"
- run: bun install --frozen-lockfile
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.package }}-dist
path: packages/${{ matrix.package }}/dist
- name: publish ${{ matrix.package }}
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}