Skip to content

✨ 改进模态窗口 #1192

✨ 改进模态窗口

✨ 改进模态窗口 #1192

Workflow file for this run

name: Build
on:
push:
branches:
- main
pull_request_target:
paths:
- "src/**"
- "src-tauri/src/**"
- "tests/**"
- "package.json"
- "vite.config.ts"
- "src-tauri/Cargo.toml"
- "src-tauri/tauri.conf.json"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
label: linux-amd64
target: x86_64-unknown-linux-gnu
- os: macos-latest
label: macos-amd64
target: x86_64-apple-darwin
- os: macos-latest
label: macos-arm64
target: aarch64-apple-darwin
- os: windows-latest
label: windows-amd64
target: x86_64-pc-windows-msvc
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_BUILD_SHA: ${{ github.event.pull_request && github.event.pull_request.head.sha || github.sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Rust setup
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
if: matrix.os != 'windows-latest'
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Pnpm setup
uses: pnpm/action-setup@v3
with:
version: 9
- name: Sync node version and setup cache
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install app dependencies and build web
run: pnpm i
- name: Rustup add target
run: rustup target add ${{ matrix.target }}
- name: Build the app
id: tauri-build
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: -t ${{ matrix.target }} -c '{"bundle":{"createUpdaterArtifacts":false}}'
- uses: actions/upload-artifact@v4
with:
name: 'matcha_${{steps.tauri-build.outputs.appVersion}}_${{ matrix.label }}'
path: "${{ join(fromJSON(steps.tauri-build.outputs.artifactPaths), '\n') }}"
comment:
needs: build
permissions:
pull-requests: write
if: github.event.pull_request && github.event.sender.type != 'Bot'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Format artifact comment
id: format-artifact-comment
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId
});
const createArtifactComment = (await import(`${{github.workspace}}/scripts/formatArtifactComment.js`)).default;
return createArtifactComment(artifacts.data.artifacts, '${{github.event.pull_request.head.sha}}');
- name: Add artifact comment
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ github.event.pull_request.number }}
header: artifacts
message: ${{ steps.format-artifact-comment.outputs.result }}