-
Notifications
You must be signed in to change notification settings - Fork 10
78 lines (73 loc) · 2.71 KB
/
node-sdk-schema-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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: "Node: Publish @serverless/sdk-schema"
on:
push:
tags:
- "@serverless/sdk-schema@[0-9]+.[0-9]+.[0-9]+"
jobs:
publishNewSdkSchemaVersion:
name: Publish new version
runs-on: ubuntu-latest
env:
# It'll work with secrets.GITHUB_TOKEN (which is provided by GitHub unconditionally)
# Still then release author would be "github-actions". It's better if it's dedicated repo bot
GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Buf Setup
uses: bufbuild/buf-setup-action@v1
- name: Install Node.js and npm
uses: actions/setup-node@v1
with:
node-version: 16.x
registry-url: https://registry.npmjs.org
- name: Retrieve ~/.npm from cache
uses: actions/cache@v2
with:
path: ~/.npm
key: npm-v16-${{ runner.os }}-refs/heads/main-${{ hashFiles('node/**package*.json') }}
restore-keys: npm-v16-${{ runner.os }}-refs/heads/main-
- name: Retrieve node_modules from cache
id: cacheNodeModules
uses: actions/cache@v2
with:
path: node/node_modules
key: node-modules-v16-${{ runner.os }}-refs/heads/main-${{ hashFiles('node/package.json') }}
restore-keys: node-modules-v16-${{ runner.os }}-refs/heads/main-A
- name: Retrieve packages/sdk-schema/node_modules from cache
id: cacheSdkSchemaNodeModules
uses: actions/cache@v2
with:
path: node/packages/sdk-schema/node_modules
key: packages/sdk-schema/node-modules-v16-${{ runner.os }}-refs/heads/main-${{ hashFiles('node/packages/sdk-schema/package.json') }}
restore-keys: packages/sdk-schema/node-modules-v16-${{ runner.os }}-refs/heads/main-
- name: Install main project dependencies
if: steps.cacheNodeModules.outputs.cache-hit != 'true'
run: |
cd node
npm update --save-dev --no-save
- name: Install packages/sdk-schema dependencies
if: steps.cacheSdkSchemaNodeModules.outputs.cache-hit != 'true'
run: |
cd node/packages/sdk-schema
npm install
- name: Build Protobufs
run: |
cd ./proto
buf build
buf generate
- name: Build
run: |
cd ./node/packages/sdk-schema
npm run build
- name: Publish New Version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd ./node/packages/sdk-schema
npm publish
- name: Publish release notes
run: |
cd node/packages/sdk-schema
TAG=${GITHUB_REF:10}
npx github-release-from-cc-changelog $TAG