Update electron-build.yml #1
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 and Release Electron App | |
on: | |
push: | |
jobs: | |
build: | |
name: Build on ${{ matrix.platform }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [linux/arm/v7, linux/arm64, linux/amd64] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Node modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 'latest' | |
- name: Install dependencies | |
run: npm install | |
- name: Rebuild native modules | |
run: | | |
npm rebuild --arch=${{ matrix.platform }} | |
- name: Build Electron App | |
run: npm run build | |
- name: Package Electron App | |
run: | | |
npm run package -- --${{ matrix.platform }} --publish never | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: electron-app-${{ matrix.platform }} | |
path: dist/*.AppImage | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v2 | |
- 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 }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./electron-app-${{ matrix.platform }}.AppImage | |
asset_name: electron-app-${{ matrix.platform }}.AppImage | |
asset_content_type: application/octet-stream |