Skip to content

Build Electron App For Win/Mac #16

Build Electron App For Win/Mac

Build Electron App For Win/Mac #16

Workflow file for this run

name: Build Electron App For Win/Mac
# github release event list: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
on:
push:
tags:
- 'v*.*.*'
# Workflow's jobs
jobs:
# job's id
release:
# job's name
name: build and release electron app
# the type of machine to run the job on
runs-on: ${{ matrix.os }}
# create a build matrix for jobs
strategy:
matrix:
os: [windows-latest, macos-latest]
# create steps
steps:
# step1: check out repository
- name: Check out git repository
uses: actions/checkout@v3
# step2: install node env
- name: Install Node.js
uses: actions/setup-node@v4
# step3: npm install
- name: npm install
run: |
npm install -f
# step4: build app for mac/win
- name: build windows app
if: matrix.os == 'windows-latest'
run: |
npm run build:win
- name: build mac app
if: matrix.os == 'macos-latest'
run: |
npm run build:mac
# step5: cleanup artifacts in dist_electron
- name: cleanup artifacts
run: |
npm run clean
# step6: upload artifacts
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: dist
# step7: create release
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: 'dist/**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write