Skip to content

Commit 65676df

Browse files
committed
ci: add GitHub Actions release workflow for Linux + macOS builds
1 parent 247ff1c commit 65676df

2 files changed

Lines changed: 88 additions & 77 deletions

File tree

.github/workflows/release.yml

Lines changed: 87 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,117 @@
1-
name: Release
1+
name: Release Build
22

33
on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version tag (e.g. v1.1.0)'
11+
required: true
712

8-
jobs:
9-
release-macos:
10-
name: Build macOS DMG
11-
runs-on: macos-latest
12-
permissions:
13-
contents: write
13+
permissions:
14+
contents: write
1415

16+
jobs:
17+
build-linux:
18+
runs-on: ubuntu-latest
1519
steps:
1620
- uses: actions/checkout@v4
1721

18-
- name: Install pnpm
19-
uses: pnpm/action-setup@v4
22+
- name: Install system dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y \
26+
libwebkit2gtk-4.1-dev \
27+
libgtk-3-dev \
28+
libayatana-appindicator3-dev \
29+
librsvg2-dev \
30+
patchelf
31+
32+
- uses: pnpm/action-setup@v4
2033
with:
21-
version: latest
34+
version: 9
2235

23-
- name: Setup Node.js
24-
uses: actions/setup-node@v4
36+
- uses: actions/setup-node@v4
2537
with:
2638
node-version: 20
27-
cache: pnpm
39+
cache: 'pnpm'
2840

29-
- name: Install Rust (stable + universal Apple targets)
30-
uses: dtolnay/rust-toolchain@stable
31-
with:
32-
targets: aarch64-apple-darwin,x86_64-apple-darwin
41+
- uses: dtolnay/rust-toolchain@stable
3342

34-
- name: Rust build cache
35-
uses: swatinem/rust-cache@v2
43+
- uses: Swatinem/rust-cache@v2
3644
with:
3745
workspaces: src-tauri
3846

39-
- name: Install JS dependencies
47+
- name: Install dependencies
4048
run: pnpm install --frozen-lockfile
4149

42-
# ── Code signing (skip gracefully when secrets are absent) ────────────
43-
- name: Import Apple Developer certificate
44-
if: env.APPLE_CERTIFICATE != ''
50+
- name: Build frontend
51+
run: pnpm frontend:build
4552
env:
46-
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
47-
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
48-
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
53+
CI: true
54+
55+
- name: Build Tauri (Linux)
4956
run: |
50-
KEYCHAIN_PATH=$RUNNER_TEMP/build.keychain
51-
CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
52-
echo -n "$APPLE_CERTIFICATE" | base64 --decode -o "$CERTIFICATE_PATH"
53-
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
54-
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
55-
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
56-
security import "$CERTIFICATE_PATH" \
57-
-P "$APPLE_CERTIFICATE_PASSWORD" \
58-
-A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
59-
security list-keychain -d user -s "$KEYCHAIN_PATH"
60-
61-
# ── Build ─────────────────────────────────────────────────────────────
62-
- name: Build universal DMG (arm64 + x86_64)
57+
cd src-tauri
58+
cargo build --release
59+
cargo tauri build --bundles appimage,deb
6360
env:
64-
# Tauri updater key (optional — set to skip updater signing)
65-
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
66-
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
67-
# Apple code signing (optional — leave unset to build unsigned)
68-
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
69-
# Apple notarization (optional — requires signing identity)
70-
APPLE_ID: ${{ secrets.APPLE_ID }}
71-
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
72-
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
73-
run: pnpm tauri build --target universal-apple-darwin
74-
75-
# ── Locate artefact ───────────────────────────────────────────────────
76-
- name: Locate DMG
77-
id: dmg
78-
run: |
79-
DMG=$(find src-tauri/target/universal-apple-darwin/release/bundle/dmg -name '*.dmg' | head -n 1)
80-
echo "path=$DMG" >> "$GITHUB_OUTPUT"
81-
echo "name=$(basename "$DMG")" >> "$GITHUB_OUTPUT"
61+
CI: true
62+
63+
- name: Upload Linux artifacts
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: linux-builds
67+
path: |
68+
src-tauri/target/release/bundle/appimage/*.AppImage
69+
src-tauri/target/release/bundle/deb/*.deb
70+
71+
- name: Upload to release
72+
if: startsWith(github.ref, 'refs/tags/')
73+
uses: softprops/action-gh-release@v2
74+
with:
75+
files: |
76+
src-tauri/target/release/bundle/appimage/*.AppImage
77+
src-tauri/target/release/bundle/deb/*.deb
78+
79+
build-macos:
80+
runs-on: macos-latest
81+
steps:
82+
- uses: actions/checkout@v4
83+
84+
- uses: pnpm/action-setup@v4
85+
with:
86+
version: 9
87+
88+
- uses: actions/setup-node@v4
89+
with:
90+
node-version: 20
91+
cache: 'pnpm'
92+
93+
- uses: dtolnay/rust-toolchain@stable
94+
95+
- uses: Swatinem/rust-cache@v2
96+
with:
97+
workspaces: src-tauri
98+
99+
- name: Install dependencies
100+
run: pnpm install --frozen-lockfile
101+
102+
- name: Build Tauri (macOS)
103+
run: pnpm desktop:build
104+
env:
105+
CI: true
82106

83-
# ── Upload artefact (always — useful for inspection) ──────────────────
84-
- name: Upload DMG artefact
107+
- name: Upload macOS artifacts
85108
uses: actions/upload-artifact@v4
86109
with:
87-
name: ${{ steps.dmg.outputs.name }}
88-
path: ${{ steps.dmg.outputs.path }}
89-
if-no-files-found: error
110+
name: macos-builds
111+
path: src-tauri/target/release/bundle/dmg/*.dmg
90112

91-
# ── Create a DRAFT release (assets are private until published) ───────
92-
- name: Create draft GitHub release
113+
- name: Upload to release
114+
if: startsWith(github.ref, 'refs/tags/')
93115
uses: softprops/action-gh-release@v2
94116
with:
95-
draft: true
96-
name: Knot Code ${{ github.ref_name }}
97-
files: ${{ steps.dmg.outputs.path }}
98-
generate_release_notes: true
99-
body: |
100-
## Knot Code ${{ github.ref_name }}
101-
102-
> **Sponsor-only download.**
103-
> Verify your [GitHub Sponsorship](https://github.com/sponsors/bunsdev) at
104-
> https://openknot.ai/download to receive the download link.
105-
106-
See the auto-generated changelog below for what's new.
117+
files: src-tauri/target/release/bundle/dmg/*.dmg

next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/dev/types/routes.d.ts";
3+
import "./.next/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

0 commit comments

Comments
 (0)