This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
113 lines (107 loc) · 3.32 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
101
102
103
104
105
106
107
108
109
110
111
112
113
name: CI/CD for the js-sdk
on:
push:
pull_request:
branches:
- 'main'
- 'beta'
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/[email protected]
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: '20'
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: '20'
cache: 'yarn'
- name: Build bundles
run: |
yarn install
yarn rollup
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ github.run_id }}-bundles
path: dist
retention-days: 3
test:
needs: [check_duplicate_workflow]
runs-on: ubuntu-20.04
if: ${{ needs.check_duplicate_workflow.outputs.should_skip != 'true' }}
env:
MOCHA_FILE: test-results/mocha/test-results.xml
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-output
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ github.run_id }}-${{ github.job }}-results
path: test-results
retention-days: 3
- name: Publish test results
uses: EnricoMi/[email protected]
with:
files: test-results/**/*.xml
release:
needs: [lint, build, test]
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') }}
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: '20'
cache: 'yarn'
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ github.run_id }}-bundles
path: dist
- name: Release, publish package
run: |
yarn install
npx semantic-release