-
Notifications
You must be signed in to change notification settings - Fork 7
117 lines (94 loc) · 2.6 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
111
112
113
114
115
116
117
name: Main
on:
push:
tags:
- v*
pull_request:
branches: [master]
jobs:
testAndBuild:
name: 'Test and build'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com
always-auth: true
- name: Install dependencies
run: yarn
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
- name: Install dependencies
run: yarn
- name: Lint
run: yarn lint
- name: Test
run: yarn test
env:
CI: 'true'
- name: Build
run: yarn build
- name: Upload artifacts
if: contains(github.ref, 'refs/tags/v') && matrix.node-version == '14.x'
uses: actions/upload-artifact@v1
with:
name: artifacts
path: ./dist
publishGitHub:
name: 'Publish to GitHub Packages'
runs-on: ubuntu-latest
needs: testAndBuild
if: contains(github.ref, 'refs/tags/v')
strategy:
matrix:
node-version: [14.x]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://npm.pkg.github.com
always-auth: true
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: artifacts
path: ./dist
- name: Publish package
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
publishNpm:
name: 'Publish to npm'
runs-on: ubuntu-latest
needs: testAndBuild
if: contains(github.ref, 'refs/tags/v')
strategy:
matrix:
node-version: [14.x]
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
always-auth: true
node-version: ${{ matrix.node-version }}
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: artifacts
path: ./dist
- name: Publish package
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
yarn publish --access public