-
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (85 loc) · 2.54 KB
/
release.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
name: Release
on:
push:
branches:
- main
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
id-token: write
packages: write
pull-requests: write
jobs:
versioning:
name: Versioning
runs-on: ubuntu-latest
steps:
- name: Checkout Repository (deep)
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Setup Bun 1.x
uses: oven-sh/setup-bun@v1
with:
bun-version: 1
- name: Install
run: pnpm install --frozen-lockfile
- name: Setup Git User
run: node .github/scripts/setup-git-user.js
- name: Generate JWT and Get Installation Access Token
id: auth
run: |
# Generate JWT
JWT=$(APP_ID=${{ vars.GH_APP_ID }} \
node .github/scripts/generate-jwt.js \
<<< "${{ secrets.GH_APP_PRIVATE_KEY }}")
# Get Installation Access Token
INSTALLATION_TOKEN=$(curl -X POST \
-H "Authorization: Bearer $JWT" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/app/installations/${{ vars.GH_INSTALLATION_ID }}/access_tokens \
| jq -r .token)
echo "TOKEN=${INSTALLATION_TOKEN}" >> $GITHUB_ENV
- name: Create Release Pull Request
run: node .github/scripts/create-versioning-pull-request.js
env:
GITHUB_TOKEN: ${{ env.TOKEN }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_HEAD_BRANCH: "automated-versioning"
GITHUB_BASE_BRANCH: "main"
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout Repository (deep)
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Setup Bun 1.x
uses: oven-sh/setup-bun@v1
with:
bun-version: 1
- name: Authenticate NPM
run: npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
- name: Install
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm nx run-many -t build --projects=@knuckles/*
- name: Publish packages
run: pnpm nx release publish