-
Notifications
You must be signed in to change notification settings - Fork 4
59 lines (51 loc) · 1.78 KB
/
release-please.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
# Manages release PR using conventional commits for updates to the main branch
name: release-please
on:
push:
branches: [main]
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Release Please
uses: GoogleCloudPlatform/[email protected]
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
# The logic below handles the npm publication:
- name: Checkout repository
uses: actions/checkout@v2
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.release_created }}
- name: Use Node.js 12.x
if: ${{ steps.release.outputs.release_created }}
uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: https://registry.npmjs.org/
- name: Cache ~/.npm
if: ${{ steps.release.outputs.release_created }}
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ runner.os }}
npm-
- name: Cache ./node_modules
if: ${{ steps.release.outputs.release_created }}
id: cache-modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ runner.os }}-12.x-${{ hashFiles('**/package-lock.json') }}
- name: Install
if: steps.release.outputs.release_created == 'true' && steps.cache-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Publish
if: ${{ steps.release.outputs.release_created }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}