-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9133cc0
commit 72a9b4b
Showing
5 changed files
with
49 additions
and
82 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,91 @@ | ||
# 可选,将显示在 GitHub 存储库的“操作”选项卡中的工作流名称 | ||
name: Release CI | ||
|
||
permissions: | ||
contents: write | ||
|
||
# 指定此工作流的触发器 | ||
on: | ||
push: | ||
# 匹配特定标签 (refs/tags) | ||
tags: | ||
- "v*" # 推送事件匹配 v*, 例如 v1.0,v20.15.10 等来触发工作流 | ||
workflow_dispatch: | ||
|
||
# 需要运行的作业组合 | ||
jobs: | ||
# 任务:创建 release 版本 | ||
create-release: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
APP_VERSION: ${{ steps.get_version.outputs.VERSION }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# 查询版本号(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}" | ||
# 安装 Node.js | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
# 发布 Release,使用自定义名称 | ||
- name: Generate changelog | ||
id: create_release | ||
run: npx changelogithub --draft --name 哔哩哔哩-直播间管家机器人${{ steps.get_version.outputs.VERSION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
|
||
|
||
# 编译 Tauri | ||
build-tauri: | ||
build-app: | ||
needs: create-release | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: [macos-latest, ubuntu-latest, windows-latest] | ||
platform: [macos-latest, ubuntu-20.04, windows-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: setup node | ||
uses: actions/setup-node@v1 | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- uses: pnpm/action-setup@v2 | ||
with: | ||
node-version: 16 | ||
|
||
# 安装 Rust | ||
- name: Install Rust stable | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
|
||
# 使用 Rust 缓存,加快安装速度 | ||
- uses: Swatinem/rust-cache@v1 | ||
version: 6.32.9 | ||
|
||
- name: install dependencies (ubuntu only) | ||
if: matrix.platform == 'ubuntu-latest' | ||
if: matrix.platform == 'ubuntu-20.04' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf | ||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev | ||
# 获取 yarn 缓存路径 | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
# 安装 Rust | ||
- name: Install Rust stable | ||
uses: dtolnay/rust-toolchain@stable | ||
|
||
# 使用 Rust 缓存,加快安装速度 | ||
- name: Rust cache | ||
uses: swatinem/rust-cache@v2 | ||
with: | ||
workspaces: './src-tauri -> target' | ||
|
||
# 使用 yarn 缓存 | ||
- name: Yarn cache | ||
uses: actions/cache@v2 | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
# 获取 pnpm 缓存 | ||
- name: Sync node version and setup cache | ||
uses: actions/setup-node@v3 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
node-version: '14' | ||
cache: 'pnpm' | ||
|
||
# 安装依赖 | ||
- name: Install app dependencies and build it | ||
run: yarn | ||
# 安装依赖, 前端打包 | ||
- name: Install app dependencies and build web | ||
run: pnpm install --frozen-lockfile | ||
|
||
# 执行构建,以及推送 github release | ||
- uses: tauri-apps/tauri-action@v0 | ||
- name: Build the app | ||
uses: tauri-apps/tauri-action@v0 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
with: | ||
tagName: ${{ needs.create-release.outputs.APP_VERSION }} | ||
releaseName: 哔哩哔哩-直播机器人 ${{ needs.create-release.outputs.APP_VERSION }} | ||
tagName: ${{ github.ref_name }} | ||
releaseName: 哔哩哔哩-直播间管家机器人 ${{ needs.create-release.outputs.APP_VERSION }} | ||
releaseBody: "" | ||
releaseDraft: true | ||
prerelease: false |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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