Skip to content

Build & Release

Build & Release #34

Workflow file for this run

name: Build & Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
args: '--target aarch64-apple-darwin'
rust_target: aarch64-apple-darwin
# Intel Mac. macos-13 is the last GitHub-hosted Intel runner
# — when it's deprecated, this entry needs to either move to
# a self-hosted x86_64 runner or be dropped (Rosetta 2 on
# arm64 build is the fallback). Native build avoids the
# lance-linalg AVX-512 cross-compile problem that killed
# the previous Intel build (commit 9f05d60).
- platform: macos-13
args: '--target x86_64-apple-darwin'
rust_target: x86_64-apple-darwin
- platform: ubuntu-22.04
args: ''
rust_target: ''
- platform: windows-latest
args: ''
rust_target: ''
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Install protoc (macOS)
if: matrix.platform == 'macos-latest'
run: brew install protobuf
- name: Install dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf protobuf-compiler
- name: Install protoc (Windows)
if: matrix.platform == 'windows-latest'
run: choco install protoc -y
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install frontend dependencies
run: npm install
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
# Tag-triggered runs publish a real GitHub Release.
# Manual (workflow_dispatch) runs leave tagName/releaseName
# empty so tauri-action skips the release-upload step and
# just produces bundle artifacts — useful for testing a
# branch build without polluting the Releases page.
tagName: ${{ github.event_name == 'push' && github.ref_name || '' }}
releaseName: ${{ github.event_name == 'push' && format('LLM Wiki {0}', github.ref_name) || '' }}
releaseBody: 'See the assets below for download links.'
releaseDraft: false
prerelease: false
args: ${{ matrix.args }}
# On workflow_dispatch, no release is created, so the bundles
# would otherwise be discarded with the runner. Upload them as
# workflow artifacts so the maintainer can `gh run download`
# the .msi / .exe / .dmg / .deb to test locally. Skipped on
# tag pushes since the release page already has them.
- name: Upload bundles as workflow artifacts (manual runs only)
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: bundle-${{ matrix.platform }}
# Glob covers both targeted (e.g.
# target/aarch64-apple-darwin/release/...) and default
# (target/release/...) build paths.
path: |
src-tauri/target/**/release/bundle/msi/*.msi
src-tauri/target/**/release/bundle/nsis/*.exe
src-tauri/target/**/release/bundle/dmg/*.dmg
src-tauri/target/**/release/bundle/deb/*.deb
src-tauri/target/**/release/bundle/appimage/*.AppImage
if-no-files-found: warn
retention-days: 14
package-extension:
name: Package browser extension
needs: build
# Browser extension is only published as part of an actual
# tagged release; manual builds don't need it.
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Sync extension manifest version and zip
run: |
# Pull version from package.json so we have a single source of
# truth. Chrome's manifest requires numeric-only version
# (e.g. 0.3.5), which matches the repo's semver convention.
APP_VERSION=$(node -p "require('./package.json').version")
node -e "
const fs = require('fs');
const p = 'extension/manifest.json';
const m = JSON.parse(fs.readFileSync(p, 'utf-8'));
m.version = '${APP_VERSION}';
fs.writeFileSync(p, JSON.stringify(m, null, 2) + '\n');
"
mkdir -p dist-extension
(cd extension && zip -r "../dist-extension/llm-wiki-extension-${APP_VERSION}.zip" . -x "*.DS_Store")
ls -la dist-extension
- name: Attach extension zip to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.ref_name }}" dist-extension/*.zip --clobber