-
Notifications
You must be signed in to change notification settings - Fork 96
99 lines (82 loc) · 2.65 KB
/
main.yml
File metadata and controls
99 lines (82 loc) · 2.65 KB
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
on:
pull_request:
branches:
- master
push:
branches:
- master
permissions:
id-token: write
contents: write
jobs:
# Job that runs for both PR and merge
ci-checks:
runs-on: ubuntu-latest
name: CI Checks (Build, Lint, Test, Release Dry-Run)
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Derive appropriate SHAs for base and head for nx affected commands
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'master'
- name: Run build on affected projects
run: npx nx affected --target=build --parallel=3
continue-on-error: false
- name: Run lint on affected projects
run: npx nx affected --target=lint --parallel=3
continue-on-error: false
- name: Run typecheck on affected projects
run: npx nx affected --target=typecheck --parallel=3
continue-on-error: false
- name: Clear Jest cache
run: npx jest --clearCache
- name: Run tests on affected projects
run: npx nx affected --target=test --parallel=3 --coverage
continue-on-error: false
# Job that runs ONLY after merge (on push to master)
release:
if: github.event_name != 'pull_request'
needs: ci-checks
runs-on: ubuntu-latest
name: Release
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.BOT_SSH_KEY }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Derive appropriate SHAs for base and head for nx affected commands
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: 'master'
- name: Build affected packages
run: npx nx affected --target=build --parallel=3
- name: 🚀 Run Nx Release
run: |
echo "registry=https://registry.npmjs.org/" >> .npmrc
git config --global user.email "${{ secrets.RELEASE_EMAIL }}"
git config --global user.name "${{ secrets.RELEASE_USERNAME }}"
npx nx release -y
env:
# NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
NPM_CONFIG_PROVENANCE: false
npm_config_legacy_peer_deps: false