-
Notifications
You must be signed in to change notification settings - Fork 8
124 lines (101 loc) · 2.97 KB
/
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
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
118
119
120
121
122
123
124
name: Publish
on:
push:
tags:
- testy-cli/v**.**.**
jobs:
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
strategy:
matrix:
node: [8.x, 10.x, 12.x, 14.x, 15.x]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
working-directory: packages/testy-cli
run: npm ci
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Build
working-directory: packages/testy-cli
run: npm run build --if-present
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Run unit tests
working-directory: packages/testy-cli
run: npm test
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
e2e-tests:
name: E2E tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [8.x, 10.x, 12.x, 14.x, 15.x]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: macos-latest
- os: windows-latest
- os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Build
working-directory: packages/testy-cli
run: npm ci
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Run e2e tests
working-directory: packages/testy-cli
run: node ./e2e/runner.js
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
publish:
name: Publish to npm
needs: [unit-tests, e2e-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
working-directory: packages/testy-cli
run: npm ci
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Build
working-directory: packages/testy-cli
run: npm run build:prod --if-present
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Extract tag
working-directory: packages/testy-cli
uses: olegtarasov/get-tag@v2.1
id: tagName
with:
tagRegex: "v[0-9]+.[0-9]+.[0-9]+-([^\\.]+)"
- name: Publish (${{ steps.tagName.outputs.tag }})
if: ${{ steps.tagName.outputs.tag != ''}}
working-directory: packages/testy-cli
run: npm publish --access public --tag ${{ steps.tagName.outputs.tag }}
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
- name: Publish (latest)
if: ${{ steps.tagName.outputs.tag == ''}}
working-directory: packages/testy-cli
run: npm publish --access public
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}