Skip to content

ExCaller v1.1.1

ExCaller v1.1.1 #37

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,不一定能正常工作,所以不支持
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5 # v2
with:
bun-version-file: .tool-versions
- name: 获取 release ID
id: get-release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # 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;
env:
REF: ${{ github.ref_name }}
REPO: ${{ github.repository }}
- 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: ${{ fromJson(steps.get-release.outputs.result).id }}
args: --target ${{ matrix.target }}
- name: 为安装包证明来源
uses: actions/attest-build-provenance@f9eaf234fc1c2e333c1eca18177db0f44fa6ba52 # v2
with:
subject-path: ${{ join(fromJSON(steps.publish.outputs.artifactPaths), ', ') }}
- id: portable
name: 提取便携式可执行文件
if: contains(matrix.target, 'windows')
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" >> "$GITHUB_OUTPUT";
- name: 上传便携式可执行文件
if: contains(matrix.target, 'windows')
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1
with:
upload_url: ${{ fromJson(steps.get-release.outputs.result).upload_url }}
asset_path: ${{ steps.portable.outputs.file }}
asset_name: ${{ steps.portable.outputs.file }}
asset_content_type: application/zip
- name: 为便携式可执行文件证明来源
if: contains(matrix.target, 'windows')
uses: actions/attest-build-provenance@f9eaf234fc1c2e333c1eca18177db0f44fa6ba52 # v2
with:
subject-path: ${{ steps.portable.outputs.file }}