-
Notifications
You must be signed in to change notification settings - Fork 15
98 lines (84 loc) · 2.53 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Build, lint, and test on Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ['14.x', '16.x']
steps:
- name: Checkout repo
uses: actions/checkout@v2
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: 'skip-ci'
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: actions/cache@v2
if: ${{ env.CI_SKIP == 'false' }}
with:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-${{ matrix.node }}-modules-${{ hashFiles('./yarn.lock') }}
- name: Install deps
if: ${{ env.CI_SKIP == 'false' }}
run: yarn install
- name: Build
if: ${{ env.CI_SKIP == 'false' }}
run: yarn build
- name: Test
if: ${{ env.CI_SKIP == 'false' }}
run: yarn test
publish:
name: Publish to NPM
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
token: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
- uses: mstachniuk/ci-skip@v1
with:
commit-filter: 'skip-ci'
- name: Git Identity
if: ${{ env.CI_SKIP == 'false' }}
run: |
git config user.name github-actions
git config user.email [email protected]
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/cache@v2
if: ${{ env.CI_SKIP == 'false' }}
with:
path: |
node_modules
packages/**/node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('./yarn.lock') }}
- name: Install dependencies
if: ${{ env.CI_SKIP == 'false' }}
run: yarn install
- name: Build Packages
if: ${{ env.CI_SKIP == 'false' }}
run: yarn build
- name: Semantic Release
if: ${{ env.CI_SKIP == 'false' }}
run: |
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
yarn release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}