Skip to content

ExCaller v1.0.0-beta.0 #23

ExCaller v1.0.0-beta.0

ExCaller v1.0.0-beta.0 #23

Workflow file for this run

name: 发布更新
on:
release:
types: [published]
jobs:
sync-latest-branch:
name: 同步 latest 分支
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: pnpm
- run: pnpm i
- name: 检查版本稳定性
id: check-stability
uses: actions/github-script@v7
with:
script: |
const { prerelease } = require('semver');
const { version } = require('./package.json');
return !prerelease(version)
- name: 更新 latest 分支
if: steps.check-stability.outputs.result == 'true'
run: |
git checkout -f -b latest origin/latest
git merge --ff-only origin/main
git push origin latest
- name: 更新 insider 分支
if: steps.check-stability.outputs.result == 'false'
run: |
git checkout -b insider origin/insider || git switch -c insider
git merge --ff-only origin/main
git push origin insider
- name: 删除 insider 分支
if: steps.check-stability.outputs.result == 'true'
run: |
git push origin -d insider || true
release:
name: 发布更新包
permissions:
contents: write
runs-on: ${{ matrix.platform }}
needs: sync-latest-branch
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
strategy:
fail-fast: false
matrix:
platform: [windows-latest, macos-latest]
include:
- platform: windows-latest
target: x86_64-pc-windows-msvc
- platform: windows-latest
target: i686-pc-windows-msvc
- platform: macos-latest
target: universal-apple-darwin
install: aarch64-apple-darwin,x86_64-apple-darwin
# i686-apple-darwin 在 Rust 平台支持的 Tier 3,不一定能正常工作,所以不支持
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: pnpm
- name: 获取 release ID
id: get-release
uses: actions/github-script@v7
with:
script: |
const [owner, repo] = process.env.REPO.split('/');
const { data } = await github.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
owner,
repo,
tag: process.env.REF,
headers: { 'X-GitHub-Api-Version': '2022-11-28' },
});
return data.id;
env:
REF: ${{ github.ref_name }}
REPO: ${{ github.repository }}
- name: 安装工具链
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.install || matrix.target }}
- name: 缓存依赖
uses: swatinem/rust-cache@v2
with:
workspaces: ./src-tauri -> target
- name: 安装 Web 端依赖
run: pnpm i
- name: 构建 Web 端
run: pnpm build:web
- name: 构建与发布安装包
uses: tauri-apps/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ steps.get-release.outputs.result }}
updaterJsonKeepUniversal: true
args: --target ${{matrix.target}}