Skip to content

v1.0.1 (#7)

v1.0.1 (#7) #11

Workflow file for this run

name: Tauri Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-tauri:
strategy:
fail-fast: false
matrix:
include:
- platform: "ubuntu-latest"
args: ""
artifact_name: "updater-json-linux"
- platform: "windows-latest"
args: "--target x86_64-pc-windows-msvc --no-sign"
artifact_name: "updater-json-windows"
- platform: "macos-latest"
args: "--target aarch64-apple-darwin --no-sign"
artifact_name: "updater-json-macos-aarch64"
- platform: "macos-latest"
args: "--target x86_64-apple-darwin --no-sign"
artifact_name: "updater-json-macos-x64"
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: |
src-tauri
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Build and publish Tauri app
uses: tauri-apps/tauri-action@v0
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:
tagName: v__VERSION__
releaseName: "DeepLab v__VERSION__"
releaseBody: "Automated release build for DeepLab v__VERSION__."
releaseDraft: false
prerelease: false
uploadUpdaterJson: false
args: ${{ matrix.args }}
- name: Collect updater json fragments
shell: bash
run: |
mkdir -p updater-json
latest_path="$(find src-tauri/target -type f -name latest.json | head -n1)"
test -n "$latest_path"
cp "$latest_path" "updater-json/${{ matrix.artifact_name }}.json"
ls -la updater-json
- name: Upload updater json fragments
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: updater-json/${{ matrix.artifact_name }}.json
if-no-files-found: error
merge-updater-json:
needs: build-tauri
runs-on: ubuntu-latest
steps:
- name: Download updater json fragments
uses: actions/download-artifact@v4
with:
path: updater-json-fragments
pattern: updater-json-*
merge-multiple: true
- name: Merge latest.json from all platforms
shell: bash
run: |
node <<'NODE'
const fs = require("fs");
const path = require("path");
const dir = "updater-json-fragments";
const files = fs.readdirSync(dir).filter((f) => f.endsWith(".json"));
if (files.length === 0) {
throw new Error("No updater latest.json fragments found");
}
let base = null;
const mergedPlatforms = {};
for (const file of files) {
const fullPath = path.join(dir, file);
const json = JSON.parse(fs.readFileSync(fullPath, "utf8"));
if (!base) {
base = {
version: json.version,
notes: json.notes ?? "",
pub_date: json.pub_date,
platforms: {},
};
}
if (json.platforms && typeof json.platforms === "object") {
Object.assign(mergedPlatforms, json.platforms);
}
}
base.platforms = mergedPlatforms;
if (Object.keys(base.platforms).length === 0) {
throw new Error("Merged latest.json has no platforms");
}
fs.writeFileSync("latest.json", JSON.stringify(base, null, 2));
console.log(`Merged platforms: ${Object.keys(base.platforms).join(", ")}`);
NODE
cat latest.json
- name: Upload merged latest.json to release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
files: latest.json
overwrite_files: true
make_latest: true
draft: false
prerelease: false