Skip to content

Merge pull request #41 from nuthx/dev-2.1.0 #49

Merge pull request #41 from nuthx/dev-2.1.0

Merge pull request #41 from nuthx/dev-2.1.0 #49

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: macOS (Apple Silicon)
os: macos-latest
target: aarch64-apple-darwin
args: --bundles dmg
artifact: subtitle-renamer_${{ github.ref_name }}_macos_aarch64.dmg
- name: macOS (Intel)
os: macos-latest
target: x86_64-apple-darwin
args: --bundles dmg
artifact: subtitle-renamer_${{ github.ref_name }}_macos_x64.dmg
- name: Windows (x64)
os: windows-latest
target: x86_64-pc-windows-msvc
args: --no-bundle
artifact: subtitle-renamer_${{ github.ref_name }}_windows_x64.zip
exeName: Subtitle Renamer.exe
- name: Windows (ARM64)
os: windows-latest
target: aarch64-pc-windows-msvc
args: --no-bundle
artifact: subtitle-renamer_${{ github.ref_name }}_windows_arm64.zip
exeName: Subtitle Renamer.exe
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: ./src -> target
- name: Install frontend dependencies
run: pnpm install
- name: Build Tauri app
run: pnpm tauri build --target ${{ matrix.target }} ${{ matrix.args }}
env:
CI: ${{ matrix.os == 'macos-latest' && 'false' || 'true' }}
- name: Prepare macOS artifact
if: matrix.os == 'macos-latest'
run: |
DMG=$(find src/target/${{ matrix.target }}/release/bundle/dmg -name "*.dmg" | head -1)
cp "$DMG" "${{ matrix.artifact }}"
- name: Prepare Windows artifact
if: matrix.os == 'windows-latest'
shell: powershell
run: |
$exe = Get-ChildItem src\target\${{ matrix.target }}\release\*.exe
Copy-Item $exe.FullName "${{ matrix.exeName }}"
Compress-Archive -Path "${{ matrix.exeName }}" -DestinationPath ${{ matrix.artifact }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ matrix.artifact }}
release:
name: Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: 🎉 ${{ github.ref_name }}
body: |
## 新增
- 新增内容
## 优化
- 优化内容
## 修复
- 修复内容
draft: true
files: |
*.dmg
*.zip