feat: add desktop updater and release automation

This commit is contained in:
lbl
2026-08-22 10:00:24 +08:00
parent da72670154
commit 60a4403f0e
42 changed files with 1374 additions and 257 deletions
+82
View File
@@ -0,0 +1,82 @@
name: PR Checks
on:
pull_request:
permissions:
contents: read
concurrency:
group: pr-checks-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
frontend:
name: Frontend checks
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.34.5
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build shared Web frontend
run: pnpm build:web
- name: Build Tauri frontend
run: pnpm build:desktop-ui
- name: Test release metadata scripts
run: node --test .github/scripts/*.test.mjs
rust:
name: ${{ matrix.name }} Rust checks
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
- name: Linux
os: ubuntu-22.04
- name: macOS
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Check workspace
run: cargo check --workspace --all-targets
- name: Run Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Run tests
run: cargo test --workspace --all-targets
+96 -3
View File
@@ -1,4 +1,4 @@
name: Rust
name: Release
on:
push:
@@ -17,8 +17,36 @@ permissions:
packages: write
jobs:
build-web:
name: Build Web frontend
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.34.5
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build shared Web frontend
run: pnpm build:web
- name: Upload Web static files
uses: actions/upload-artifact@v4
with:
name: vnt-web-static
path: vnt-web/static
retention-days: 1
build:
name: Build ${{ matrix.TARGET }}
needs: build-web
strategy:
fail-fast: false
matrix:
@@ -60,7 +88,14 @@ jobs:
OS: ${{ matrix.OS }}
FEATURES: ${{ matrix.FEATURES }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Replace Web static files with current frontend build
run: rm -rf vnt-web/static && mkdir -p vnt-web/static
- name: Download Web static files
uses: actions/download-artifact@v4
with:
name: vnt-web-static
path: vnt-web/static
- name: Init submodules
run: git submodule update --init --recursive --remote && git submodule status
- name: Cargo cache
@@ -279,4 +314,62 @@ jobs:
file: ./artifacts/*/*.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file_glob: true
desktop-windows:
name: Build and publish VNT Desktop for Windows
if: startsWith(github.ref, 'refs/tags/')
needs: deploy
runs-on: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10.34.5
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Verify tag matches desktop version
shell: pwsh
run: |
$config = Get-Content vnt-desktop/src-tauri/tauri.conf.json | ConvertFrom-Json
$tagVersion = "${{ github.ref_name }}" -replace '^v', ''
if ($tagVersion -ne $config.version) {
throw "Tag ${{ github.ref_name }} does not match desktop version $($config.version)"
}
- name: Build and publish Windows desktop installers
uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
projectPath: vnt-desktop
tagName: ${{ github.ref_name }}
releaseName: VNT ${{ github.ref_name }}
releaseDraft: false
prerelease: false
releaseAssetNamePattern: 'VNT.Desktop_[version]_windows_[arch][setup][ext]'
args: --bundles nsis,msi
release-notes:
name: Add download links to release notes
if: startsWith(github.ref, 'refs/tags/')
needs: desktop-windows
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Update updater metadata and release notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .github/scripts/update-release-downloads.mjs