-
Notifications
You must be signed in to change notification settings - Fork 67
56 lines (50 loc) · 2.1 KB
/
node-ci.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
name: Node.js CI
on:
push:
branches:
- master
pull_request:
jobs:
test-build-release:
env:
IS_PUSH_TO_MASTER: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install npm packages using cache
uses: bahmutov/npm-install@v1
with:
# the IBI Group TSDX fork has some dependency issues
# that cause yarn install to fail on a ci runner. Disabling
# concurrency allows installation to complete successfully
install-command: yarn --frozen-lockfile --network-concurrency 1
- name: Lint code
run: yarn lint
- name: Run tests with coverage
run: yarn cover
# at this point, the build is successful
- name: Semantic Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release
# Steps below deal with uploading Storybook to S3,
# which is only performed with a push to the main branch.
# Note that AWS CLI v2 is already installed by default on GitHub's Ubuntu 20.04.
# per https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#cli-tools.
- name: Add AWS credentials
if: ${{ env.IS_PUSH_TO_MASTER == 'true' }}
run: mkdir ~/.aws && printf '%s\n' '[default]' "aws_access_key_id=$AWS_ACCESS_KEY_ID" "aws_secret_access_key=$AWS_SECRET_ACCESS_KEY" "region=$AWS_REGION" > ~/.aws/config
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Deploy storybook demo to S3 if handling a push (non-PR build) on the main branch
# https://s3.amazonaws.com/transitive.js/index.html
- name: Deploy storybook to S3
if: ${{ env.IS_PUSH_TO_MASTER == 'true' }}
run: yarn deploy-storybook