Skip to content

Commit 5fb2113

Browse files
committed
ci/docs: add reusable packages workflow and mux server docs
1 parent cb9bdaf commit 5fb2113

File tree

4 files changed

+254
-201
lines changed

4 files changed

+254
-201
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -7,99 +7,16 @@ on:
77
workflow_dispatch: # Allow manual triggering
88

99
jobs:
10-
build-macos:
11-
name: Build macOS
12-
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-15' || 'macos-latest' }}
13-
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
with:
17-
fetch-depth: 0 # Required for git describe to find tags
18-
19-
- uses: ./.github/actions/setup-mux
20-
21-
- name: Setup code signing
22-
run: ./scripts/setup-macos-signing.sh
23-
env:
24-
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
25-
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
26-
AC_APIKEY_P8_BASE64: ${{ secrets.AC_APIKEY_P8_BASE64 }}
27-
AC_APIKEY_ID: ${{ secrets.AC_APIKEY_ID }}
28-
AC_APIKEY_ISSUER_ID: ${{ secrets.AC_APIKEY_ISSUER_ID }}
29-
30-
- name: Verify signing setup
31-
run: |
32-
if [ -n "${CSC_LINK:-}" ]; then
33-
echo "✅ Code signing enabled"
34-
security list-keychains -d user
35-
security find-identity -v -p codesigning
36-
else
37-
echo "⚠️ Code signing NOT enabled"
38-
fi
39-
40-
- name: Package for macOS
41-
run: make dist-mac
42-
env:
43-
CSC_FOR_PULL_REQUEST: ${{ github.event.pull_request.number == 234 }}
44-
45-
- name: Upload macOS DMG (x64)
46-
uses: actions/upload-artifact@v4
47-
with:
48-
name: macos-dmg-x64
49-
path: release/*-x64.dmg
50-
retention-days: 30
51-
if-no-files-found: error
52-
53-
- name: Upload macOS DMG (arm64)
54-
uses: actions/upload-artifact@v4
55-
with:
56-
name: macos-dmg-arm64
57-
path: release/*-arm64.dmg
58-
retention-days: 30
59-
if-no-files-found: error
60-
61-
build-linux:
62-
name: Build Linux
63-
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
64-
steps:
65-
- name: Checkout code
66-
uses: actions/checkout@v4
67-
with:
68-
fetch-depth: 0 # Required for git describe to find tags
69-
70-
- uses: ./.github/actions/setup-mux
71-
72-
- name: Build application
73-
run: bun run build
74-
75-
- name: Package for Linux
76-
run: make dist-linux
77-
78-
- name: Upload Linux AppImage
79-
uses: actions/upload-artifact@v4
80-
with:
81-
name: linux-appimage
82-
path: release/*.AppImage
83-
retention-days: 30
84-
if-no-files-found: error
85-
86-
build-vscode-extension:
87-
name: Build VS Code Extension
88-
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
89-
steps:
90-
- name: Checkout code
91-
uses: actions/checkout@v4
92-
with:
93-
fetch-depth: 0 # Required for git describe to find tags
94-
95-
- uses: ./.github/actions/setup-mux
96-
97-
- uses: ./.github/actions/build-vscode-extension
98-
99-
- name: Upload VS Code extension artifact
100-
uses: actions/upload-artifact@v4
101-
with:
102-
name: vscode-extension
103-
path: vscode/mux-*.vsix
104-
retention-days: 30
105-
if-no-files-found: error
10+
build-artifacts:
11+
name: Build desktop + extension artifacts
12+
uses: ./.github/workflows/packages.yml
13+
with:
14+
mode: build
15+
secrets:
16+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
17+
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
18+
AC_APIKEY_P8_BASE64: ${{ secrets.AC_APIKEY_P8_BASE64 }}
19+
AC_APIKEY_ID: ${{ secrets.AC_APIKEY_ID }}
20+
AC_APIKEY_ISSUER_ID: ${{ secrets.AC_APIKEY_ISSUER_ID }}
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
VSCE_PAT: ${{ secrets.VSCE_PAT }}

.github/workflows/packages.yml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
name: Build Artifacts
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
mode:
7+
description: 'Set to "build" for CI artifacts or "release" for signed releases.'
8+
required: true
9+
type: string
10+
secrets:
11+
MACOS_CERTIFICATE:
12+
required: false
13+
MACOS_CERTIFICATE_PWD:
14+
required: false
15+
AC_APIKEY_P8_BASE64:
16+
required: false
17+
AC_APIKEY_ID:
18+
required: false
19+
AC_APIKEY_ISSUER_ID:
20+
required: false
21+
GH_TOKEN:
22+
required: false
23+
VSCE_PAT:
24+
required: false
25+
26+
jobs:
27+
macos:
28+
name: ${{ inputs.mode == 'release' && 'Build and Release macOS' || 'Build macOS' }}
29+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-macos-15' || 'macos-latest' }}
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
36+
- uses: ./.github/actions/setup-mux
37+
38+
- name: Setup code signing
39+
run: ./scripts/setup-macos-signing.sh
40+
env:
41+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
42+
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
43+
AC_APIKEY_P8_BASE64: ${{ secrets.AC_APIKEY_P8_BASE64 }}
44+
AC_APIKEY_ID: ${{ secrets.AC_APIKEY_ID }}
45+
AC_APIKEY_ISSUER_ID: ${{ secrets.AC_APIKEY_ISSUER_ID }}
46+
47+
- name: Verify signing setup
48+
if: inputs.mode == 'build'
49+
run: |
50+
if [ -n "${CSC_LINK:-}" ]; then
51+
echo "✅ Code signing enabled"
52+
security list-keychains -d user
53+
security find-identity -v -p codesigning
54+
else
55+
echo "⚠️ Code signing NOT enabled"
56+
fi
57+
58+
- name: Build application
59+
run: bun run build
60+
61+
- name: Package for macOS
62+
if: inputs.mode == 'build'
63+
run: make dist-mac
64+
env:
65+
CSC_FOR_PULL_REQUEST: ${{ github.event.pull_request.number == 234 }}
66+
67+
- name: Package and publish for macOS
68+
if: inputs.mode == 'release'
69+
run: make dist-mac-release
70+
env:
71+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
72+
73+
- name: Upload macOS DMG (x64)
74+
if: inputs.mode == 'build'
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: macos-dmg-x64
78+
path: release/*-x64.dmg
79+
retention-days: 30
80+
if-no-files-found: error
81+
82+
- name: Upload macOS DMG (arm64)
83+
if: inputs.mode == 'build'
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: macos-dmg-arm64
87+
path: release/*-arm64.dmg
88+
retention-days: 30
89+
if-no-files-found: error
90+
91+
linux:
92+
name: ${{ inputs.mode == 'release' && 'Build and Release Linux' || 'Build Linux' }}
93+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
94+
steps:
95+
- name: Checkout code
96+
uses: actions/checkout@v4
97+
with:
98+
fetch-depth: 0
99+
100+
- uses: ./.github/actions/setup-mux
101+
102+
- name: Build application
103+
run: bun run build
104+
105+
- name: Package for Linux
106+
if: inputs.mode == 'build'
107+
run: make dist-linux
108+
109+
- name: Package and publish for Linux
110+
if: inputs.mode == 'release'
111+
run: bun x electron-builder --linux --publish always
112+
env:
113+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
114+
115+
- name: Upload Linux AppImage
116+
if: inputs.mode == 'build'
117+
uses: actions/upload-artifact@v4
118+
with:
119+
name: linux-appimage
120+
path: release/*.AppImage
121+
retention-days: 30
122+
if-no-files-found: error
123+
124+
windows:
125+
name: ${{ inputs.mode == 'release' && 'Build and Release Windows' || 'Build Windows' }}
126+
runs-on: windows-latest
127+
steps:
128+
- name: Checkout code
129+
uses: actions/checkout@v4
130+
with:
131+
fetch-depth: 0
132+
133+
- uses: ./.github/actions/setup-mux
134+
135+
- name: Install GNU Make
136+
shell: powershell
137+
run: choco install -y make
138+
139+
- name: Verify tools
140+
shell: bash
141+
run: |
142+
make --version
143+
bun --version
144+
magick --version | head -1
145+
146+
- name: Build application
147+
shell: pwsh
148+
run: bun run build
149+
150+
- name: Package for Windows (.exe)
151+
if: inputs.mode == 'build'
152+
shell: pwsh
153+
run: make dist-win
154+
155+
- name: Package and publish for Windows (.exe)
156+
if: inputs.mode == 'release'
157+
shell: pwsh
158+
run: bun x electron-builder --win --publish always
159+
env:
160+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
161+
162+
- name: Upload Windows installer (.exe)
163+
if: inputs.mode == 'build'
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: windows-installer
167+
path: release/*.exe
168+
retention-days: 30
169+
if-no-files-found: error
170+
171+
vscode-extension:
172+
name: ${{ inputs.mode == 'release' && 'Build and Publish VS Code Extension' || 'Build VS Code Extension' }}
173+
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-16' || 'ubuntu-latest' }}
174+
steps:
175+
- name: Checkout code
176+
uses: actions/checkout@v4
177+
with:
178+
fetch-depth: 0
179+
180+
- uses: ./.github/actions/setup-mux
181+
182+
- uses: ./.github/actions/build-vscode-extension
183+
184+
- name: Upload VS Code extension artifact
185+
if: inputs.mode == 'build'
186+
uses: actions/upload-artifact@v4
187+
with:
188+
name: vscode-extension
189+
path: vscode/mux-*.vsix
190+
retention-days: 30
191+
if-no-files-found: error
192+
193+
- name: Upload VS Code extension to release
194+
if: inputs.mode == 'release'
195+
env:
196+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
197+
run: |
198+
gh release upload ${{ github.event.release.tag_name }} \
199+
vscode/mux-*.vsix \
200+
--clobber
201+
202+
- name: Publish to VS Code Marketplace
203+
if: inputs.mode == 'release' && secrets.VSCE_PAT != ''
204+
working-directory: vscode
205+
env:
206+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
207+
run: |
208+
bunx vsce publish -p $VSCE_PAT

0 commit comments

Comments
 (0)