Update electron-build.yml #29
Workflow file for this run
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: | |
tags: | |
- "v*" | |
jobs: | |
build: | |
name: Build on ${{ matrix.platform }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: [armv7l, x64] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildxarm64 | |
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: Setup Pre-Built socketcan Binaries | |
run: | | |
if [ "${{ matrix.platform }}" = "armv7l" ]; then | |
CAN_FILE=can-armv7l.node | |
CAN_SIGNALS_FILE=can_signals-armv7l.node | |
elif [ "${{ matrix.platform }}" = "arm64" ]; then | |
CAN_FILE=can-arm64.node | |
CAN_SIGNALS_FILE=can_signals-arm64.node | |
elif [ "${{ matrix.platform }}" = "x64" ]; then | |
CAN_FILE=can-x64.node | |
CAN_SIGNALS_FILE=can_signals-x64.node | |
fi | |
mkdir -p node_modules/socketcan/build/Release | |
cp prebuilt/socketcan/$CAN_FILE node_modules/socketcan/build/Release/can.node | |
cp prebuilt/socketcan/$CAN_SIGNALS_FILE node_modules/socketcan/build/Release/can_signals.node | |
- name: Setup Pre-Built socketcan Binaries | |
run: | | |
if [ "${{ matrix.platform }}" = "armv7l" ]; then | |
EXPAT_FILE=node_expat-armv7l.node | |
elif [ "${{ matrix.platform }}" = "arm64" ]; then | |
EXPAT_FILE=node_expat-arm64.node | |
elif [ "${{ matrix.platform }}" = "x64" ]; then | |
EXPAT_FILE=node_expat-x64.node | |
fi | |
mkdir -p node_modules/node-expat/build/Release | |
cp prebuilt/node-expat/$CAN_FILE node_modules/node-expat/build/Release/node_expat.node | |
- name: Install Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20.10.0" | |
- name: Install dependencies | |
run: npm install | |
- name: Setup Pre-Built socketcan Binaries | |
run: | | |
if [ "${{ matrix.platform }}" = "armv7l" ]; then | |
CAN_FILE=can-armv7l.node | |
CAN_SIGNALS_FILE=can_signals-armv7l.node | |
elif [ "${{ matrix.platform }}" = "arm64" ]; then | |
CAN_FILE=can-arm64.node | |
CAN_SIGNALS_FILE=can_signals-arm64.node | |
elif [ "${{ matrix.platform }}" = "x64" ]; then | |
CAN_FILE=can-x64.node | |
CAN_SIGNALS_FILE=can_signals-x64.node | |
fi | |
mkdir -p node_modules/socketcan/build/Release | |
cp prebuilt/socketcan/$CAN_FILE node_modules/socketcan/build/Release/can.node | |
cp prebuilt/socketcan/$CAN_SIGNALS_FILE node_modules/socketcan/build/Release/can_signals.node | |
- name: Setup Pre-Built node-expat Binaries | |
run: | | |
if [ "${{ matrix.platform }}" = "armv7l" ]; then | |
EXPAT_FILE=node_expat-armv7l.node | |
elif [ "${{ matrix.platform }}" = "arm64" ]; then | |
EXPAT_FILE=node_expat-arm64.node | |
elif [ "${{ matrix.platform }}" = "x64" ]; then | |
EXPAT_FILE=node_expat-x64.node | |
fi | |
mkdir -p node_modules/node-expat/build/Release | |
cp prebuilt/node-expat/$EXPAT_FILE node_modules/node-expat/build/Release/node_expat.node | |
- name: Extract version | |
run: echo "VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV | |
- name: Build Electron App | |
run: CI=false npm run build:linux -- --${{ matrix.platform }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: FLos-${{ matrix.platform }}-${{ env.VERSION }}.AppImage | |
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: ./FLos-${{ matrix.platform }}-${{ env.VERSION }}.AppImage | |
asset_name: FLos-${{ matrix.platform }}-${{ env.VERSION }}.AppImage | |
asset_content_type: application/octet-stream |