-
-
Notifications
You must be signed in to change notification settings - Fork 5
63 lines (60 loc) · 2.05 KB
/
release.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
name: release
on:
push:
branches:
- main
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
packages: ${{ steps.get-released-packages.outputs.result }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest
monorepo-tags: true
- uses: actions/checkout@v3
if: ${{ steps.release.outputs.releases_created }}
- id: get-released-packages
if: ${{ steps.release.outputs.releases_created }}
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const path = require('path');
const outputs = ${{ toJSON(steps.release.outputs) }};
return Object.keys(outputs)
.map((key) => {
const match = key.match(/^(.*\/.*)--release_created$/);
if (!match) return;
return require(path.join('${{ github.workspace }}', match[1], 'package.json')).name;
})
.filter(Boolean);
npm-publish:
needs: release-please
if: ${{ needs.release-please.outputs.releases_created }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.release-please.outputs.packages )}}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org'
- run: yarn install
- id: package-name
run: |
PACKAGE_NAME=$(node -p "PACKAGE_NAME='${{ matrix.package }}'.split('/')[1]")
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT
- run: npm publish --provenance --access public
working-directory: packages/${{ steps.package-name.outputs.PACKAGE_NAME }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}