Skip to content

ExCaller v1.1.1

ExCaller v1.1.1 #40

Workflow file for this run

name: 发布更新
on:
release:
types: [published]
permissions:
contents: write
id-token: write
attestations: write
jobs:
sync-latest-branch:
name: 同步 latest 分支
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version-file: .tool-versions
- run: bun i semver@7
- name: 检查版本稳定性
id: check-stability
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 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: 发布更新包
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
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,不一定能正常工作,所以不支持
env:
ENABLE_PORTABLE: ${{ contains(matrix.target, 'windows') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version-file: .tool-versions
- name: 安装工具链
uses: actions-rust-lang/setup-rust-toolchain@9399c7bb15d4c7d47b27263d024f0a4978346ba4 # v1
with:
target: ${{ matrix.install || matrix.target }}
- name: 缓存依赖
uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2
with:
workspaces: ./src-tauri -> target
- name: 安装 Web 端依赖
run: bun i --frozen-lockfile
- name: 构建 Web
run: bun run build:web
- id: publish
name: 构建与发布安装包
uses: tauri-apps/tauri-action@94571df7fd79dbe2aee6d279c0a6b66d086d3b3b # v0.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ github.event.release.id }}
args: --target ${{ matrix.target }}
- id: portable
name: 提取便携式可执行文件
if: env.ENABLE_PORTABLE == 'true'
shell: pwsh
run: |
$bits = if ('${{ matrix.target }}' -match 'i686') { 'x86' } else { 'x64' };
$name = "ExCaller_${{ steps.publish.outputs.appVersion }}_${bits}_portable";
mkdir $name;
mv ./src-tauri/target/${{ matrix.target }}/release/ex-caller.exe ./$name/ExCaller.exe;
echo "{}" > ./$name/data.json;
Compress-Archive -Path ./$name -DestinationPath ./$name.zip;
echo "file=$name.zip" >> "$env:GITHUB_OUTPUT";
- name: 上传便携式可执行文件
if: env.ENABLE_PORTABLE == 'true'
uses: AButler/upload-release-assets@3d6774fae0ed91407dc5ae29d576b166536d1777 # v3.0
with:
files: ${{ steps.portable.outputs.file }}
release-id: ${{ github.event.release.id }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
attest:
name: 证明来源
runs-on: ubuntu-latest
needs: release
steps:
- id: download
name: 下载附件
uses: robinraju/release-downloader@a96f54c1b5f5e09e47d9504526e96febd949d4c2 # v1
with:
fileName: '*'
releaseId: ${{ github.event.release.id }}
- name: 证明来源
uses: actions/attest-build-provenance@f9eaf234fc1c2e333c1eca18177db0f44fa6ba52 # v2
with:
subject-path: ${{ join(fromJson(steps.download.outputs.downloaded_files), ', ') }}