-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (140 loc) · 5.41 KB
/
Copy pathrelease.yml
File metadata and controls
176 lines (140 loc) · 5.41 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Release
# A tag publishes; a manual run builds the same artifacts without publishing,
# which is how a release is rehearsed before its version number is spent.
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
# Two runs for the same tag would race to create one release. Queue instead of
# cancelling, so a rehearsal already in flight still finishes.
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
macos:
runs-on: macos-latest
steps:
# The only target is arm64, and nothing else in the job would notice if
# GitHub's default runner ever moved back to Intel.
- name: Confirm the runner is arm64
run: |
if [ "$(uname -m)" != "arm64" ]; then
echo "This build targets arm64 only; the runner reports $(uname -m)." >&2
exit 1
fi
- uses: actions/checkout@v4
# Reads the pinned version from package.json's packageManager field.
- uses: pnpm/action-setup@v4
# Deliberately uncached. Restoring the pnpm store replays Electron's
# postinstall from cached output instead of extracting the download, and
# that copy flattens the symlinks inside Electron Framework.framework.
# codesign then calls the bundle ambiguous and refuses to verify it, so
# the minute this saves costs the release its signature.
- uses: actions/setup-node@v4
with:
node-version: 22
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm test
# A tag naming a version the app does not carry would ship an artifact
# whose filename disagrees with its own release page.
- name: Confirm the tag matches the package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
tagged="${GITHUB_REF_NAME#v}"
packaged="$(node -p "require('./package.json').version")"
if [ "$tagged" != "$packaged" ]; then
echo "Tag $GITHUB_REF_NAME does not match package.json version $packaged." >&2
exit 1
fi
- name: Build the app
# Without this, electron-builder searches the keychain for a Developer
# ID this build deliberately does not have. Signing is ad-hoc and
# happens in the afterPack hook.
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
run: pnpm dist
# An arm64 bundle with no signature at all installs fine and then fails to
# launch with no error, so the signature is confirmed before publishing.
- name: Confirm the bundle is signed
run: codesign --verify --strict "release/mac-arm64/Codex Quota.app"
- uses: actions/upload-artifact@v4
with:
name: codex-quota-macos-arm64
path: |
release/*.dmg
release/*.zip
if-no-files-found: error
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm test
- name: Confirm the tag matches the package version
if: startsWith(github.ref, 'refs/tags/v')
shell: pwsh
run: |
$tagged = $env:GITHUB_REF_NAME.Substring(1)
$packaged = node -p "require('./package.json').version"
if ($tagged -ne $packaged) {
Write-Error "Tag $env:GITHUB_REF_NAME does not match package.json version $packaged."
exit 1
}
- name: Build the Windows installer
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
run: pnpm dist:win
- uses: actions/upload-artifact@v4
with:
name: codex-quota-windows-x64
path: |
release/CodexQuota-*-win-*.exe
if-no-files-found: error
publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: [macos, windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist
- name: Publish the release
env:
GH_TOKEN: ${{ github.token }}
run: |
cat > release-notes.md <<'NOTES'
## Install
### macOS
Download the DMG, open it, and drag **Codex Quota** to Applications.
The build is signed ad-hoc and is not notarized, so the first launch
needs the quarantine flag cleared:
```bash
xattr -dr com.apple.quarantine "/Applications/Codex Quota.app"
```
Apple silicon only.
### Windows
Download the NSIS installer (`CodexQuota-*-win-x64.exe`) and run it.
Closing the window leaves the app in the notification area; quit from
the tray icon.
The installer is unsigned. Windows may show a SmartScreen warning on
first launch — choose **More info** and **Run anyway** if you trust
the build.
The app runs whatever `codex` is already installed on the machine and
does not bundle a copy.
NOTES
gh release create "$GITHUB_REF_NAME" \
--title "Codex Quota $GITHUB_REF_NAME" \
--notes-file release-notes.md \
dist/codex-quota-macos-arm64/*.dmg \
dist/codex-quota-macos-arm64/*.zip \
dist/codex-quota-windows-x64/*.exe