Skip to content

fix github action

fix github action #8

Workflow file for this run

name: Build Binary
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
# --- 仅 macOS 需要的步骤:导入证书 ---
- name: Import Certificates (macOS only)
if: runner.os == 'macOS'
uses: apple-actions/import-codesign-certs@v3
with:
p12-file-base64: ${{ secrets.P12_CERTIFICATE_BASE64 }}
p12-password: ${{ secrets.P12_PASSWORD }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
# --- 仅 macOS 需要的步骤:签名 ---
- name: Code Sign Binary (macOS only)
if: runner.os == 'macOS'
run: |
codesign --force --options runtime --deep \
--sign "Developer ID Application: Xiaolin Zhai (GKKM6A9PRT)" \
target/${{ matrix.target }}/release/riqi
# --- 仅 macOS 需要的步骤:公证 ---
- name: Notarize (macOS only)
if: runner.os == 'macOS'
run: |
zip -j ${{ matrix.artifact_name }}.zip target/${{ matrix.target }}/release/riqi
xcrun notarytool submit ${{ matrix.artifact_name }}.zip \
--apple-id "${{ secrets.APPLE_ID }}" \
--password "${{ secrets.APPLE_PASSWORD }}" \
--team-id "${{ secrets.TEAM_ID }}" \
--wait
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/riqi
target/${{ matrix.target }}/release/riqi.exe
if-no-files-found: error
- name: release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/${{ matrix.target }}/release/riqi
target/${{ matrix.target }}/release/riqi.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}