优化打包 #67
Workflow file for this run
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
name: Build App | |
permissions: | |
contents: write | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
release: | |
name: build and release electron app | |
runs-on: ${{ matrix.os }} | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
steps: | |
- name: Check out git repository | |
uses: actions/[email protected] | |
- name: Install Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 16 | |
- name: Install Dependencies | |
run: | | |
npm i -g pnpm | |
pnpm install | |
- name: Build Electron App for windows | |
if: matrix.os == 'windows-latest' | |
run: pnpm run build:win | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
- name: Build Electron App for macos | |
if: matrix.os == 'macos-latest' | |
run: | | |
pnpm run build:github-mac | |
pnpm run build:github-mac-arm64 | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
# - name: Build Electron App for linux | |
# if: matrix.os == 'ubuntu-latest' | |
# run: | | |
# pnpm run build:linux-x86 | |
# pnpm run build:linux-arm64 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
- name: Cleanup Artifacts for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
npx del-cli "dist/*" "!dist/*.exe" "!dist/*.zip" "!dist/*.yml" | |
- name: Cleanup Artifacts for MacOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
npx del "dist/*" "!dist/(*.dmg|*.zip|latest*.yml)" | |
- name: Cleanup Artifacts for Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
npx del "dist/*" "!dist/(*.AppImage.*|latest*.yml|*.appimage.*)" | |
- name: upload artifacts | |
uses: actions/[email protected] | |
with: | |
name: ${{ matrix.os }} | |
path: dist | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: 'dist/**' | |
env: | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |