📦 Chore(custom): update release action

This commit is contained in:
Kuingsmile
2025-08-14 15:24:14 +08:00
parent 1a9ab5b614
commit 15d205b30a
2 changed files with 43 additions and 20 deletions

View File

@@ -1,9 +1,5 @@
# main.yml name: Build for release
# Workflow's name
name: Auto Build
# Workflow's trigger
on: on:
workflow_dispatch: workflow_dispatch:
@@ -22,7 +18,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, macos-13, windows-latest, windows-11-arm] os: [ubuntu-latest, macos-13, windows-latest, windows-11-arm, macos-latest]
steps: steps:
@@ -35,7 +31,7 @@ jobs:
# step2: sign # step2: sign
- name: Install the Apple certificates - name: Install the Apple certificates
if: matrix.os == 'macos-13' if: matrix.os == 'macos-13' || matrix.os == 'macos-latest'
run: | run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
@@ -52,16 +48,15 @@ jobs:
sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils sudo apt-get install --no-install-recommends -y icnsutils graphicsmagick xz-utils
# step3: yarn # step3: yarn
- name: Yarn install macos - name: Install dependencies (macOS)
if: matrix.os == 'macos-13' if: matrix.os == 'macos-13' || matrix.os == 'macos-latest'
run: | run: |
yarn config set ignore-engines true yarn config set ignore-engines true
yarn yarn
yarn global add xvfb-maybe yarn global add xvfb-maybe
npm rebuild --platform=darwin --arch=arm64 sharp
- name: Yarn install windows - name: Install dependencies (Windows)
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest' || matrix.os == 'windows-11-arm'
run: | run: |
yarn config set ignore-engines true yarn config set ignore-engines true
yarn yarn
@@ -90,6 +85,18 @@ jobs:
$config.win.target[0].arch = @("arm64") $config.win.target[0].arch = @("arm64")
$config | ConvertTo-Json -Depth 10 | Set-Content electron-builder.json $config | ConvertTo-Json -Depth 10 | Set-Content electron-builder.json
- name: Modify electron-builder.json for Macos x64
if: matrix.os == 'macos-13'
run: |
# Remove arm64 from the arch array, keep only x64
jq '.mac.target[0].arch = ["x64"]' electron-builder.json > tmp.json && mv tmp.json electron-builder.json
- name: Modify electron-builder.json for Macos ARM64
if: matrix.os == 'macos-latest'
run: |
# Remove x64 from the arch array, keep only arm64
jq '.mac.target[0].arch = ["arm64"]' electron-builder.json > tmp.json && mv tmp.json electron-builder.json
- name: Build & release app - name: Build & release app
run: | run: |
yarn release yarn release
@@ -131,11 +138,21 @@ jobs:
retention-days: 30 retention-days: 30
if-no-files-found: error if-no-files-found: error
- name: Upload macOS packages - name: Upload macOS x64 packages
if: matrix.os == 'macos-13' if: matrix.os == 'macos-13'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: macos-packages name: macos-x64-packages
path: |
dist_electron/*
retention-days: 30
if-no-files-found: error
- name: Upload macOS ARM64 packages
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: macos-arm64-packages
path: | path: |
dist_electron/* dist_electron/*
retention-days: 30 retention-days: 30
@@ -171,11 +188,21 @@ jobs:
retention-days: 30 retention-days: 30
if-no-files-found: error if-no-files-found: error
- name: Upload macOS yml - name: Upload macOS x64 yml
if: matrix.os == 'macos-13' if: matrix.os == 'macos-13'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: macos-yml name: macos-x64-yml
path: |
dist_electron/github/*
retention-days: 30
if-no-files-found: error
- name: Upload macOS ARM64 yml
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: macos-arm64-yml
path: | path: |
dist_electron/github/* dist_electron/github/*
retention-days: 30 retention-days: 30

View File

@@ -1,9 +1,5 @@
# test-build.yml
# Workflow's name
name: Test Build name: Test Build
# Workflow's trigger
on: on:
workflow_dispatch: workflow_dispatch: