2024-08-28 19:14:39 +08:00

76 lines
2.5 KiB
YAML

name: Build and Package Electron App on Release
on:
release:
types: [published]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
node-version: [20.x]
include:
- os: windows-latest
build_all: false
- os: macos-latest
build_all: true
- os: ubuntu-latest
build_all: true
steps:
- name: Checkout
if: matrix.os == 'windows-latest' || github.event.release.prerelease == false
uses: actions/checkout@v4.1.7
- name: Set up Node.js
if: matrix.os == 'windows-latest' || github.event.release.prerelease == false
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
if: matrix.os == 'windows-latest' || github.event.release.prerelease == false
run: yarn install
- name: Build and package for Windows
if: matrix.os == 'windows-latest'
run: yarn build:win
- name: Build and package for macOS
if: matrix.os == 'macos-latest' && github.event.release.prerelease == false
run: yarn build:mac
- name: Build and package for Linux
if: matrix.os == 'ubuntu-latest' && github.event.release.prerelease == false
run: yarn build:linux
- name: Upload artifact for Windows
if: matrix.os == 'windows-latest'
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/*.exe
asset_name: ExamShowboard-Windows-amd64.exe
asset_content_type: application/octet-stream
- name: Upload artifact for macOS
if: matrix.os == 'macos-latest' && github.event.release.prerelease == false
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/*.dmg
asset_name: ExamShowboard-macOS-arm64.dmg
asset_content_type: application/octet-stream
- name: Upload artifact for Linux
if: matrix.os == 'ubuntu-latest' && github.event.release.prerelease == false
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: dist/*.AppImage
asset_name: ExamShowboard-Linux.AppImage
asset_content_type: application/octet-stream