-
Notifications
You must be signed in to change notification settings - Fork 4
100 lines (94 loc) · 2.79 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
name: CI/CD
on:
push:
pull_request:
branches:
- 'main'
jobs:
# This job uses skip-duplicate-actions to skip one of the duplicate workflow runs when you push to a branch with an open PR.
check_duplicate_workflow:
needs: []
runs-on: ubuntu-20.04
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.1
with:
skip_after_successful_duplicate: 'true'
concurrent_skipping: 'same_content_newer'
do_not_skip: '["push"]'
lint:
needs: [check_duplicate_workflow]
runs-on: ubuntu-20.04
if: ${{ needs.check_duplicate_workflow.outputs.should_skip != 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Run lint
run: |
yarn install
yarn lint
build:
needs: [check_duplicate_workflow]
runs-on: ubuntu-20.04
if: ${{ needs.check_duplicate_workflow.outputs.should_skip != 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Build bundles
run: |
yarn install
yarn build
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ github.run_id }}-bundles
path: lib
retention-days: 3
test:
needs: [check_duplicate_workflow]
runs-on: ubuntu-20.04
if: ${{ needs.check_duplicate_workflow.outputs.should_skip != 'true' }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Run tests
run: |
yarn install
yarn test
release:
needs: [lint, build, test]
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELASTICPATH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ github.run_id }}-bundles
path: lib
- name: Release, publish package
run: |
yarn install
npx semantic-release