-
Notifications
You must be signed in to change notification settings - Fork 5
52 lines (49 loc) · 1.53 KB
/
nodejs.yml
File metadata and controls
52 lines (49 loc) · 1.53 KB
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
name: Node.js CI
on: [push, pull_request]
jobs:
test:
name: "Test on Node"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10
- uses: actions/cache@v2
id: yarn-cache
with:
path: "node_modules"
key: ${{ runner.os }}-node-v10-yarn-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
- run: yarn lint
- run: yarn typecheck
- run: yarn test
release:
runs-on: ubuntu-latest
needs: test
if: contains(github.ref, 'tags/')
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10
registry-url: "https://registry.npmjs.org"
- uses: actions/cache@v2
id: yarn-cache
with:
path: "node_modules"
key: ${{ runner.os }}-node-v10-yarn-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
if: steps.yarn-cache.outputs.cache-hit != 'true'
- run: |
ORG_NAME=$(echo ${{ github.ref }} | sed -r "s/refs\/tags\/(.+?)-.+@.+/\1/")
API_NAME=$(echo ${{ github.ref }} | sed -r "s/refs\/tags\/.+?-(.+?)@.+/\1/")
npm run update $ORG_NAME $API_NAME
npm run build apis/$ORG_NAME/$API_NAME
cd apis/$ORG_NAME/$API_NAME
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}