-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (110 loc) · 3.21 KB
/
main.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
103
104
105
106
107
108
109
110
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v2
with:
path: node_modules
key: 14-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn
- run: yarn build
- run: yarn test
version-bump:
name: Bump Package Version
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Cache package.json
id: cache-package-json
uses: actions/cache@v2
with:
path: package.json
key: ${{ github.sha }}-package-json
- uses: "phips28/[email protected]"
with:
tag-prefix: ""
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
name: Publish NPM
needs: version-bump
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta
with:
node-version: "14"
registry-url: https://registry.npmjs.org/
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v2
with:
path: node_modules
key: 14-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Cache package.json
id: cache-package-json
uses: actions/cache@v2
with:
path: package.json
key: ${{ github.sha }}-package-json
- name: Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Build
run: yarn build
- name: NPM Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# publish-gpr:
# name: Publish GPR
# needs: version-bump
# runs-on: ubuntu-latest
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v2-beta
# with:
# node-version: "14"
# registry-url: "https://npm.pkg.github.com"
# - name: Cache node_modules
# id: cache-modules
# uses: actions/cache@v2
# with:
# path: node_modules
# key: 14-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
# - name: Cache package.json
# id: cache-package-json
# uses: actions/cache@v2
# with:
# path: package.json
# key: ${{ github.sha }}-package-json
# - name: Install
# if: steps.cache-modules.outputs.cache-hit != 'true'
# run: yarn install --frozen-lockfile
# - name: Build
# run: yarn build
# - name: GPR Publish
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}