-
-
Notifications
You must be signed in to change notification settings - Fork 4
90 lines (75 loc) · 2.54 KB
/
release-production.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
name: Release
on:
push:
branches:
- main
- v1
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # needed for provenance data generation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
# Step 1: Check out the repository code
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire history to allow proper versioning
# Step 2: Setup pnpm package manager
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
# Step 3: Set up Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.OS }}-20.x-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-20.x-
# Step 5: Install dependencies
- name: Install dependencies
run: pnpm i --frozen-lockfile
# Step 6: Set SHAs for nx workspace
- name: Set SHAs for Nx workspace
uses: nrwl/nx-set-shas@v4
# Step 7: Run lint and test for the affected changes
- name: Run Nx lint and test
run: pnpx nx affected -t lint test --exclude nextjs,vue3
# Step 8: Run the build for the affected changes
- name: Run build
run: pnpm build
# Step 9: Set github authour
- name: Setup git user to "🤖 nabla bot"
run: git config user.email "-" && git config user.name "🤖 nabla bot"
# Step 10: Run the release
- name: Run Nx release version
run: pnpm exec nx release --skip-publish
# Step 11: Run the build for the affected changes
- name: Run build
run: pnpm build
# Step 12: Run publish
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
# Use npx instead of yarn because yarn automagically sets NPM_* environment variables
# like NPM_CONFIG_REGISTRY so npm publish ends up ignoring the .npmrc file
# which is set up by `setup-node` action.
run: pnpx nx release publish --access public --verbose --tag
# Step 13: Upload artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: './dist'