v3.0.5 #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 可选,将显示在 GitHub 存储库的“操作”选项卡中的工作流名称 | |
name: Release CI | |
# 指定此工作流的触发器 | |
on: | |
push: | |
# 匹配特定标签 (refs/tags) | |
tags: | |
- "v*" # 推送事件匹配 v*, 例如 v1.0,v20.15.10 等来触发工作流 | |
# 需要运行的作业组合 | |
jobs: | |
# 任务:创建 release 版本 | |
create-release: | |
runs-on: ubuntu-latest | |
outputs: | |
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} | |
steps: | |
- uses: actions/checkout@v3 | |
# 查询版本号(tag) | |
- name: Query version number | |
id: get_version | |
shell: bash | |
run: | | |
echo "using version tag ${GITHUB_REF:10}" | |
echo ::set-output name=version::"${GITHUB_REF:10}" | |
# 根据查询到的版本号创建 release | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: false | |
tag_name: "${{ steps.get_version.outputs.VERSION }}" | |
release_name: "Live2d ${{ steps.get_version.outputs.VERSION }}" | |
body: "See the assets to download this version and install." | |
# 编译 Tauri | |
build-tauri: | |
needs: create-release | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [macos-latest, windows-latest, ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
# 安装 Node.js | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 7 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
# 安装 Rust | |
- name: Install Rust stable | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
# 使用 Rust 缓存,加快安装速度 (没感觉快) | |
- name: Rust-cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: ${{ runner.os }}-Rust | |
# ubuntu-latest webkit2gtk-4.0相关依赖 | |
- name: Install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf | |
# 安装依赖执行构建,以及推送 github release | |
- name: Install app dependencies and build it | |
run: pnpm i && pnpm build | |
- uses: tauri-apps/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
with: | |
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} | |
updater: | |
runs-on: ubuntu-latest | |
needs: [create-release, build-tauri] | |
steps: | |
- uses: actions/checkout@v3 | |
- run: yarn && yarn updater | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy install.json | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./updater | |
force_orphan: true |