Skip to content

发布更新

发布更新 #12

Workflow file for this run

name: 发布更新
on:
workflow_dispatch:
jobs:
sync-latest-branch:
name: 同步 latest 分支
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
git checkout -b latest origin/latest
git merge --ff-only origin/main
git push origin latest
release:
name: 发布更新包
env:
EXC_ENV: App
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- 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: 安装 macOS 工具链
if: ${{ matrix.platform == 'macos-latest' }}
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin, x86_64-apple-darwin
- name: 安装 Windows 工具链
if: ${{ matrix.platform == 'windows-latest' }}
uses: dtolnay/rust-toolchain@stable
with:
targets: i686-pc-windows-msvc, x86_64-pc-windows-msvc
- uses: swatinem/rust-cache@v2
with:
workspaces: ./src-tauri -> target
- uses: pnpm/action-setup@v2
with:
version: 8
- run: pnpm install
- run: pnpm web:build
- name: 构建与发布 macOS 安装包
if: ${{ matrix.platform == 'macos-latest' }}
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ steps.get-release.outputs.result }}
args: --target universal-apple-darwin
- name: 构建与发布 Windows x64 安装包
if: ${{ matrix.platform == 'windows-latest' }}
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ steps.get-release.outputs.result }}
args: --target x86_64-pc-windows-msvc
- name: 构建与发布 Windows x86 安装包
if: ${{ matrix.platform == 'windows-latest' }}
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ steps.get-release.outputs.result }}
args: --target i686-pc-windows-msvc