Build Electron Application #9
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 Electron Application | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
type: boolean | |
description: Release artifacts | |
required: false | |
default: false | |
push: | |
branches: | |
- "main" | |
paths: | |
- "um-react" | |
workflow_call: | |
inputs: | |
commit: | |
type: string | |
default: main | |
release: | |
type: boolean | |
default: false | |
permissions: | |
contents: write | |
jobs: | |
build-linux-windows: | |
name: Build Linux & Windows | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Install system dependencies | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update | |
sudo apt-get install npm wine32 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Install npm dependencies | |
run: | | |
git submodule update --init --recursive | |
cd um-react | |
pnpm install --frozen-lockfile | |
cd .. | |
npm install --frozen-lockfile | |
- name: Update version | |
id: version | |
run: | | |
um_ver=$(npm info ./um-react version) | |
npm version $um_ver --allow-same-version --no-commit-hooks --no-git-tag-version | |
echo $um_ver | |
echo version=$um_ver >> "$GITHUB_OUTPUT" | |
- name: Build | |
run: | | |
npm run build:win | |
npm run build:linux | |
- name: Upload Windows build | |
uses: actions/[email protected] | |
with: | |
name: Windows build 7z | |
path: release/**/*.7z | |
- name: Upload Linux build | |
uses: actions/[email protected] | |
with: | |
name: Linux build AppImage | |
path: release/**/*.AppImage | |
build-macos: | |
name: Build macOS | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Install system dependencies | |
run: brew install node | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Install npm dependencies | |
run: | | |
git submodule update --init --recursive | |
cd um-react | |
pnpm install --frozen-lockfile | |
cd .. | |
npm install --frozen-lockfile | |
- name: Update version | |
run: | | |
um_ver=$(npm info ./um-react version) | |
npm version $um_ver --allow-same-version --no-commit-hooks --no-git-tag-version | |
echo $um_ver | |
- name: Build | |
run: | | |
npm run build:mac | |
- name: Upload macOS build | |
uses: actions/[email protected] | |
with: | |
name: macOS build dmg | |
path: release/**/*.dmg | |
upload-release: | |
name: Upload Release | |
runs-on: ubuntu-latest | |
if: ${{ inputs.release || github.event_name == 'push' || github.event_name == 'repository_dispatch' }} | |
needs: [build-linux-windows, build-macos] | |
steps: | |
- name: Download release files | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Upload release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ needs.build-linux-windows.outputs.version }}/* | |
tag: ${{ needs.build-linux-windows.outputs.version }} | |
body: Release ${{ needs.build-linux-windows.outputs.version }} | |
target_commit: ${{ inputs.commit || github.sha }} | |
overwrite: true | |
file_glob: true |