Skip to content

Build and Release Electron App #1

Build and Release Electron App

Build and Release Electron App #1

Workflow file for this run

name: Build
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- '**.spec.js'
- '.idea'
- '.vscode'
- '.dockerignore'
- 'Dockerfile'
- '.gitignore'
- '.github/**'
- '!.github/workflows/build.yml'
tags:
- 'v*.*.*' # 只在推送标签时触发
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: npm install
- name: Build Release Files
run: npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: release_on_${{ matrix.os }}
path: release/
retention-days: 5
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Artifact from macOS
uses: actions/download-artifact@v3
with:
name: release_on_macos-latest
path: ./macos
- name: Download Artifact from Ubuntu
uses: actions/download-artifact@v3
with:
name: release_on_ubuntu-latest
path: ./ubuntu
- name: Download Artifact from Windows
uses: actions/download-artifact@v3
with:
name: release_on_windows-latest
path: ./windows
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
This is the release for ${{ github.ref }}.
draft: false
prerelease: false
- name: Upload macOS Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./macos
asset_name: macos_release.zip
asset_content_type: application/zip
- name: Upload Ubuntu Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ubuntu
asset_name: ubuntu_release.zip
asset_content_type: application/zip
- name: Upload Windows Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./windows
asset_name: windows_release.zip
asset_content_type: application/zip