-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (66 loc) · 1.77 KB
/
test-and-release.yaml
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
name: Test and Release
on:
push:
workflow_dispatch:
permissions:
id-token: write
contents: write
issues: write
actions: write
env:
CI: 1
FORCE_COLOR: 3
JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION: 1
jobs:
unit-tests:
runs-on: ubuntu-24.04
outputs:
ref: ${{ steps.ref.outputs.ref }}
steps:
- uses: actions/checkout@v4
- name: store checkout out version
id: ref
run: echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit
- name: Compile TypeScript
run: npx tsc
- name: Check source code with eslint
run: npx eslint .
- name: Check if source code is properly formatted
run: npx prettier -c ./
- name: Run Unit Tests
run: npm test
release:
needs:
- unit-tests
runs-on: ubuntu-24.04
if: github.ref == 'refs/heads/saga'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.e2e-tests.outputs.ref }}
- uses: actions/setup-node@v4
with:
node-version: "22.x"
cache: "npm"
- name: Install dependencies
run: npm ci --no-audit
- name: Semantic release
id: semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx semantic-release
- name: Trigger deployment workflow
if: steps.semantic-release.outcome == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh workflow run deploy.yaml \
-F ref=${{ needs.unit-tests.outputs.ref }}