-
-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (97 loc) · 2.81 KB
/
release-please-4.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: release-please
on:
workflow_call:
inputs:
config-file:
description: 'The path to the release-please config file'
required: false
default: '.github/release-please/config.json'
type: string
manifest-file:
description: 'The path to the release-please manifest file'
required: false
default: '.github/release-please/manifest.json'
type: string
publish-to-github:
description: 'Publish to GitHub Package Registry'
required: false
default: false
type: boolean
lockfile:
description: 'Whether to expect a lockfile or not'
required: false
default: false
type: boolean
npm-tag:
description: 'The distribution tag to publish to on npm'
required: false
default: 'latest'
type: string
permissions:
contents: read
jobs:
release_please:
name: release-please
runs-on: ubuntu-latest
outputs:
releaseCreated: ${{ steps.release.outputs.release_created }}
permissions:
contents: write
pull-requests: write
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: ${{ inputs.config-file }}
manifest-file: ${{ inputs.manifest-file }}
npm_publish:
name: Publish to npm
runs-on: ubuntu-latest
environment: npm
needs: release_please
if: needs.release_please.outputs.releaseCreated
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm
- if: inputs.lockfile == false
run: npm install
- if: inputs.lockfile == true
run: npm ci
- run: npm publish --provenance --access public --tag=${{ inputs.npm-tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
gpr_publish:
name: Publish to GitHub Package Registry
runs-on: ubuntu-latest
needs: release_please
if: inputs.publish-to-github && needs.release_please.outputs.releaseCreated
permissions:
packages: write
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
show-progress: false
- uses: actions/setup-node@v4
with:
node-version: lts/*
- if: inputs.lockfile == false
run: npm install
- if: inputs.lockfile == true
run: npm ci
- uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: 'https://npm.pkg.github.com'
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}