Skip to content

Commit e683bdd

Browse files
committed
ci: support Intel and Windows release targets
1 parent 6947d7b commit e683bdd

3 files changed

Lines changed: 314 additions & 66 deletions

File tree

.github/workflows/build.yml

Lines changed: 123 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,21 @@ on:
2121
- beta
2222
- prod
2323
default: dev
24+
target:
25+
description: "Release target"
26+
required: false
27+
type: choice
28+
options:
29+
- macos
30+
- windows
31+
default: macos
2432
arch:
2533
description: "Target architecture"
2634
required: false
2735
type: choice
2836
options:
2937
- arm64
38+
- x64
3039
default: arm64
3140
source_run_id:
3241
description: "Run ID from the submit phase"
@@ -58,16 +67,91 @@ on:
5867
type: string
5968

6069
concurrency:
61-
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.phase || 'submit' }}
70+
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.phase || 'submit' }}-${{ inputs.target || 'macos' }}-${{ inputs.arch || 'arm64' }}
6271
cancel-in-progress: true
6372

6473
permissions:
6574
actions: read
6675
contents: write
6776

6877
jobs:
78+
select-build-target:
79+
runs-on: ubuntu-latest
80+
outputs:
81+
matrix: ${{ steps.select.outputs.matrix }}
82+
target: ${{ steps.select.outputs.target }}
83+
arch: ${{ steps.select.outputs.arch }}
84+
steps:
85+
- id: select
86+
run: |
87+
set -euo pipefail
88+
89+
target="${INPUT_TARGET:-macos}"
90+
arch="${INPUT_ARCH:-arm64}"
91+
phase="${INPUT_PHASE:-submit}"
92+
93+
case "$target" in
94+
macos)
95+
case "$arch" in
96+
arm64)
97+
host="macos-latest"
98+
platform_flag="--mac --arm64"
99+
;;
100+
x64)
101+
host="macos-15-intel"
102+
platform_flag="--mac --x64"
103+
;;
104+
*)
105+
echo "Unsupported macOS arch: $arch"
106+
exit 1
107+
;;
108+
esac
109+
;;
110+
windows)
111+
if [ "$phase" = "finalize" ]; then
112+
echo "Windows releases do not use the macOS notarization finalize phase"
113+
exit 1
114+
fi
115+
if [ "$arch" != "x64" ]; then
116+
echo "Unsupported Windows arch: $arch"
117+
exit 1
118+
fi
119+
host="windows-latest"
120+
platform_flag="--win"
121+
;;
122+
*)
123+
echo "Unsupported release target: $target"
124+
exit 1
125+
;;
126+
esac
127+
128+
matrix=$(python3 - <<PY
129+
import json
130+
print(json.dumps({
131+
"include": [{
132+
"host": "$host",
133+
"target": "$target",
134+
"platform_flag": "$platform_flag",
135+
"arch_label": "$arch",
136+
}]
137+
}))
138+
PY
139+
)
140+
141+
{
142+
echo "target=$target"
143+
echo "arch=$arch"
144+
echo "matrix=$matrix"
145+
} >> "$GITHUB_OUTPUT"
146+
env:
147+
INPUT_TARGET: ${{ inputs.target || 'macos' }}
148+
INPUT_ARCH: ${{ inputs.arch || 'arm64' }}
149+
INPUT_PHASE: ${{ inputs.phase || 'submit' }}
150+
69151
create-snapshot-tag:
70-
if: ${{ inputs.phase == 'submit' }}
152+
needs:
153+
- select-build-target
154+
if: ${{ inputs.phase == 'submit' && needs.select-build-target.outputs.target == 'macos' }}
71155
runs-on: ubuntu-latest
72156
permissions:
73157
contents: write
@@ -79,7 +163,7 @@ jobs:
79163
run: |
80164
set -euo pipefail
81165
82-
workflow_ref="workflow-snapshot-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${{ inputs.arch || 'arm64' }}"
166+
workflow_ref="workflow-snapshot-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}-${{ needs.select-build-target.outputs.target }}-${{ needs.select-build-target.outputs.arch }}"
83167
gh api \
84168
--method POST \
85169
-H "Accept: application/vnd.github+json" \
@@ -93,39 +177,33 @@ jobs:
93177

94178
build-electron:
95179
needs:
180+
- select-build-target
96181
- create-snapshot-tag
97-
if: ${{ always() && (needs.create-snapshot-tag.result == 'success' || needs.create-snapshot-tag.result == 'skipped') }}
182+
if: ${{ always() && needs.select-build-target.result == 'success' && (needs.create-snapshot-tag.result == 'success' || needs.create-snapshot-tag.result == 'skipped') }}
98183
strategy:
99184
fail-fast: false
100-
matrix:
101-
include:
102-
- host: macos-latest
103-
platform_flag: --mac --arm64
104-
arch_label: arm64
105-
# Uncomment after signing is verified:
106-
# - host: macos-latest
107-
# platform_flag: --mac --x64
108-
# arch_label: x64
109-
# - host: ubuntu-latest
110-
# platform_flag: --linux
111-
# arch_label: x64
112-
# - host: windows-latest
113-
# platform_flag: --win
114-
# arch_label: x64
185+
matrix: ${{ fromJSON(needs.select-build-target.outputs.matrix) }}
115186

116187
runs-on: ${{ matrix.host }}
117188

118189
steps:
119-
- name: Validate Selected Arch
190+
- name: Validate selected target
191+
shell: bash
120192
run: |
121193
set -euo pipefail
122194
123-
if [ "$SELECTED_ARCH" != "arm64" ]; then
124-
echo "Unsupported arch: $SELECTED_ARCH"
195+
if [ "$SELECTED_TARGET" != "${{ matrix.target }}" ]; then
196+
echo "Target mismatch: expected $SELECTED_TARGET, got ${{ matrix.target }}"
197+
exit 1
198+
fi
199+
200+
if [ "$SELECTED_ARCH" != "${{ matrix.arch_label }}" ]; then
201+
echo "Arch mismatch: expected $SELECTED_ARCH, got ${{ matrix.arch_label }}"
125202
exit 1
126203
fi
127204
env:
128-
SELECTED_ARCH: ${{ inputs.arch || 'arm64' }}
205+
SELECTED_TARGET: ${{ needs.select-build-target.outputs.target }}
206+
SELECTED_ARCH: ${{ needs.select-build-target.outputs.arch }}
129207

130208
- name: Validate finalize inputs
131209
if: ${{ inputs.phase == 'finalize' }}
@@ -639,11 +717,32 @@ jobs:
639717
640718
- name: Package app
641719
if: ${{ runner.os != 'macOS' && inputs.phase != 'finalize' }}
642-
run: npx electron-builder ${{ matrix.platform_flag }} --publish never --config electron-builder.config.ts
720+
shell: bash
721+
run: |
722+
set -euo pipefail
723+
724+
publish_flag="never"
725+
if [ "${{ inputs.phase || 'submit' }}" = "full" ]; then
726+
publish_flag="always"
727+
fi
728+
729+
npx electron-builder ${{ matrix.platform_flag }} --publish "$publish_flag" --config electron-builder.config.ts
643730
working-directory: packages/desktop-electron
644731
timeout-minutes: 60
645732
env:
646733
OPENCODE_CHANNEL: ${{ inputs.channel || 'dev' }}
734+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
735+
736+
- name: Upload packaged app artifact
737+
if: ${{ runner.os == 'Windows' && inputs.phase != 'finalize' }}
738+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
739+
with:
740+
name: pawwork-${{ runner.os }}-${{ matrix.arch_label }}
741+
if-no-files-found: error
742+
path: |
743+
packages/desktop-electron/dist/*.exe
744+
packages/desktop-electron/dist/*.exe.blockmap
745+
packages/desktop-electron/dist/latest*.yml
647746
648747
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
649748
if: ${{ runner.os == 'macOS' && (inputs.phase == 'finalize' || inputs.phase == 'full') && inputs.arch == matrix.arch_label }}

0 commit comments

Comments
 (0)