Publish Raspberry Pi #4
This file contains hidden or 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: Publish Raspberry Pi | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| # Job 1: arm64のビルド | |
| build-arm64: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout git repo | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: arm64 | |
| - name: Install build tools | |
| run: sudo apt-get install -y build-essential | |
| - name: Install libfuse2 | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libfuse2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Install serialport from source | |
| run: | | |
| cd release/app | |
| npm install serialport --build-from-source --arch=arm64 | |
| - name: Build application | |
| run: npm run build | |
| - name: Build and publish for arm64 | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| npm exec electron-builder -- --publish always --arm64 | |
| # Job 2: armv7lのビルド | |
| build-armv7l: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. ソースコードをチェックアウト | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2. arm32v7 Dockerコンテナ内でビルドと公開の全工程を実行 | |
| - name: Build and Publish inside arm32v7 container | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| docker run --rm \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| -w /workspace \ | |
| -e GH_TOKEN \ | |
| arm32v7/node:18 \ | |
| /bin/bash -c ' | |
| set -e | |
| echo "--- Installing root dependencies ---" | |
| npm install --arch=armv7l | |
| echo "--- Rebuilding native modules ---" | |
| cd release/app && npm install | |
| cd ../.. | |
| echo "--- Building application (TS -> JS) ---" | |
| npm run build | |
| echo "--- Packaging and publishing application for armv7l ---" | |
| npm exec electron-builder -- --publish always --armv7l | |
| ' |