Skip to content

Commit 36041c0

Browse files
committed
ci
1 parent b5e5d4c commit 36041c0

File tree

2 files changed

+99
-27
lines changed

2 files changed

+99
-27
lines changed

.github/workflows/generate.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ jobs:
1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@v4
19-
with:
20-
token: ${{ secrets.GITHUB_TOKEN }}
21-
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
22-
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
2319

2420
- name: Setup Bun
2521
uses: ./.github/actions/setup-bun
@@ -36,6 +32,10 @@ jobs:
3632

3733
- name: Commit and push
3834
run: |
35+
if [ -z "$(git status --porcelain)" ]; then
36+
echo "No changes to commit"
37+
exit 0
38+
fi
3939
git add -A
4040
git commit -m "chore: generate" --allow-empty
4141
git push origin HEAD:${{ github.ref_name }} --no-verify

.github/workflows/publish.yml

Lines changed: 95 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
needs: version
6161
runs-on: blacksmith-4vcpu-ubuntu-2404
6262
if: github.repository == 'anomalyco/opencode'
63+
container:
64+
image: ghcr.io/anomalyco/build/bun-node:24.04
6365
steps:
6466
- uses: actions/checkout@v3
6567
with:
@@ -84,7 +86,7 @@ jobs:
8486
outputs:
8587
version: ${{ needs.version.outputs.version }}
8688

87-
build-tauri:
89+
build-tauri-linux:
8890
needs:
8991
- build-cli
9092
- version
@@ -93,17 +95,13 @@ jobs:
9395
fail-fast: false
9496
matrix:
9597
settings:
96-
- host: macos-latest
97-
target: x86_64-apple-darwin
98-
- host: macos-latest
99-
target: aarch64-apple-darwin
100-
- host: blacksmith-4vcpu-windows-2025
101-
target: x86_64-pc-windows-msvc
10298
- host: blacksmith-4vcpu-ubuntu-2404
10399
target: x86_64-unknown-linux-gnu
104100
- host: blacksmith-4vcpu-ubuntu-2404-arm
105101
target: aarch64-unknown-linux-gnu
106102
runs-on: ${{ matrix.settings.host }}
103+
container:
104+
image: ghcr.io/anomalyco/build/tauri-linux:24.04
107105
steps:
108106
- uses: actions/checkout@v3
109107
with:
@@ -131,21 +129,6 @@ jobs:
131129
132130
- uses: ./.github/actions/setup-bun
133131

134-
- name: Cache apt packages
135-
if: contains(matrix.settings.host, 'ubuntu')
136-
uses: actions/cache@v4
137-
with:
138-
path: /var/cache/apt/archives
139-
key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-${{ hashFiles('.github/workflows/publish.yml') }}
140-
restore-keys: |
141-
${{ runner.os }}-${{ matrix.settings.target }}-apt-
142-
143-
- name: install dependencies (ubuntu only)
144-
if: contains(matrix.settings.host, 'ubuntu')
145-
run: |
146-
sudo apt-get update
147-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
148-
149132
- name: install Rust stable
150133
uses: dtolnay/rust-toolchain@stable
151134
with:
@@ -169,7 +152,6 @@ jobs:
169152

170153
# Fixes AppImage build issues, can be removed when https://github.com/tauri-apps/tauri/pull/12491 is released
171154
- name: Install tauri-cli from portable appimage branch
172-
if: contains(matrix.settings.host, 'ubuntu')
173155
run: |
174156
cargo install tauri-cli --git https://github.com/tauri-apps/tauri --branch feat/truly-portable-appimage --force
175157
echo "Installed tauri-cli version:"
@@ -200,11 +182,101 @@ jobs:
200182
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
201183
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
202184

185+
build-tauri:
186+
needs:
187+
- build-cli
188+
- version
189+
continue-on-error: false
190+
strategy:
191+
fail-fast: false
192+
matrix:
193+
settings:
194+
- host: macos-latest
195+
target: x86_64-apple-darwin
196+
- host: macos-latest
197+
target: aarch64-apple-darwin
198+
- host: blacksmith-4vcpu-windows-2025
199+
target: x86_64-pc-windows-msvc
200+
runs-on: ${{ matrix.settings.host }}
201+
steps:
202+
- uses: actions/checkout@v3
203+
with:
204+
fetch-tags: true
205+
206+
- uses: apple-actions/import-codesign-certs@v2
207+
if: ${{ runner.os == 'macOS' }}
208+
with:
209+
keychain: build
210+
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
211+
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
212+
213+
- name: Verify Certificate
214+
if: ${{ runner.os == 'macOS' }}
215+
run: |
216+
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application")
217+
CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}')
218+
echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV
219+
echo "Certificate imported."
220+
221+
- name: Setup Apple API Key
222+
if: ${{ runner.os == 'macOS' }}
223+
run: |
224+
echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
225+
226+
- uses: ./.github/actions/setup-bun
227+
228+
- name: install Rust stable
229+
uses: dtolnay/rust-toolchain@stable
230+
with:
231+
targets: ${{ matrix.settings.target }}
232+
233+
- uses: Swatinem/rust-cache@v2
234+
with:
235+
workspaces: packages/desktop/src-tauri
236+
shared-key: ${{ matrix.settings.target }}
237+
238+
- name: Prepare
239+
run: |
240+
cd packages/desktop
241+
bun ./scripts/prepare.ts
242+
env:
243+
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
244+
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
245+
RUST_TARGET: ${{ matrix.settings.target }}
246+
GH_TOKEN: ${{ github.token }}
247+
GITHUB_RUN_ID: ${{ github.run_id }}
248+
249+
- name: Build and upload artifacts
250+
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
251+
timeout-minutes: 60
252+
with:
253+
projectPath: packages/desktop
254+
uploadWorkflowArtifacts: true
255+
tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
256+
args: --target ${{ matrix.settings.target }} --config ./src-tauri/tauri.prod.conf.json --verbose
257+
updaterJsonPreferNsis: true
258+
releaseId: ${{ needs.version.outputs.release }}
259+
tagName: ${{ needs.version.outputs.tag }}
260+
releaseDraft: true
261+
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
262+
env:
263+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
264+
TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true
265+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
266+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
267+
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
268+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
269+
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
270+
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
271+
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
272+
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
273+
203274
publish:
204275
needs:
205276
- version
206277
- build-cli
207278
- build-tauri
279+
- build-tauri-linux
208280
runs-on: blacksmith-4vcpu-ubuntu-2404
209281
steps:
210282
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)