-
Notifications
You must be signed in to change notification settings - Fork 1
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
d0e1986
commit d8133f6
Showing
3 changed files
with
37 additions
and
19 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -6,23 +6,27 @@ on: | |
- renovate/** | ||
push: | ||
branches-ignore: | ||
- insider | ||
- latest | ||
- renovate/** | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
autofix: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: package.json | ||
- uses: pnpm/action-setup@v4 | ||
with: | ||
run_install: true | ||
cache: pnpm | ||
|
||
- run: pnpm install | ||
- run: pnpm lint --fix | ||
|
||
- uses: autofix-ci/[email protected] | ||
with: | ||
commit-message: 'style: autofix' |
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 |
---|---|---|
|
@@ -13,34 +13,41 @@ jobs: | |
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 检查版本稳定性 | ||
id: check-stability | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
import { prerelease } from 'semver' | ||
import { version } from './package.json' | ||
const { prerelease } = require('semver'); | ||
const { version } = require('./package.json'); | ||
return !prerelease(version) | ||
- name: 更新 latest 分支 | ||
if: steps.check-stability.outputs.result | ||
run: | | ||
git checkout -b latest origin/latest | ||
git merge --ff-only origin/main | ||
git push origin latest | ||
- name: 更新 insider 分支 | ||
if: !steps.check-stability.outputs.result | ||
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 | ||
run: | | ||
git push origin -d insider || true | ||
release: | ||
name: 发布更新包 | ||
permissions: | ||
contents: write | ||
runs-on: ${{ matrix.platform }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -54,41 +61,45 @@ jobs: | |
target: universal-apple-darwin | ||
install: aarch64-apple-darwin,x86_64-apple-darwin | ||
# i686-apple-darwin 在 Rust 平台支持的 Tier 3,不一定能正常工作,所以不支持 | ||
runs-on: ${{ matrix.platform }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: package.json | ||
cache: pnpm | ||
|
||
- name: 获取 release ID | ||
id: get-release | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const [owner, repo] = process.env.REPO.split('/') | ||
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 | ||
}); | ||
return data.id; | ||
env: | ||
REF: ${{ github.ref_name }} | ||
REPO: ${{ github.repository }} | ||
|
||
- name: 安装工具链 | ||
uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
with: | ||
target: ${{ matrix.install || matrix.target }} | ||
|
||
- name: 缓存依赖 | ||
uses: swatinem/rust-cache@v2 | ||
with: | ||
workspaces: ./src-tauri -> target | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
run_install: true | ||
|
||
- name: 构建应用 | ||
run: pnpm web:build | ||
|
||
- name: 构建与发布安装包 | ||
uses: tauri-apps/[email protected] | ||
env: | ||
|
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,23 +1,26 @@ | ||
name: 代码质量测试 | ||
|
||
on: | ||
pull_request: | ||
branches-ignore: | ||
- renovate/** | ||
push: | ||
branches-ignore: | ||
- insider | ||
- latest | ||
- renovate/** | ||
pull_request: | ||
|
||
jobs: | ||
unit-test: | ||
name: 单元测试 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: package.json | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
run_install: true | ||
- name: 运行单元测试 | ||
run: pnpm test | ||
cache: pnpm | ||
|
||
- run: pnpm install | ||
- run: pnpm test |