-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (73 loc) · 2.23 KB
/
release.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
name: Conventional Release
on:
push:
branches:
- master
jobs:
# Run tests
test:
runs-on: ubuntu-latest
steps:
# Checkout git branch
- uses: actions/checkout@v2
# Install node.js environment
- uses: actions/setup-node@v2
with:
node-version: 16.x
# Cache node_modules (busting only when yarn.lock change)
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
# Install dependencies
- name: Install
run: yarn install --frozen-lockfile --silent
# Run all tests
- name: Test
run: yarn run test --ci --coverage
# Conventional release
release:
needs: test
runs-on: ubuntu-latest
steps:
# Checkout git branch
- uses: actions/checkout@v2
with:
# Fetch the entire history
fetch-depth: 0
# Install node.js environment
- uses: actions/setup-node@v2
with:
node-version: 16.x
# Cache node_modules (busting only when yarn.lock change)
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
# Configure git with the built-in token
# (to push back the release updates: package.json's version, CHANGELOG etc.)
- name: Configure Git & NPM
run: |
git config user.name github-actions
git config user.email [email protected]
# Install dependencies
- name: Install
run: yarn install --frozen-lockfile --silent
# Build all packages
- name: Build
run: yarn run build
# Authenticate yarn towards registry.npmjs.org
- name: Authenticate with Registry
run: |
yarn logout
echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> .npmrc
npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Publish packages
- name: Release
run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}