diff --git a/.github/workflows/build-electron.yml b/.github/workflows/build-electron.yml new file mode 100644 index 0000000..533a4f0 --- /dev/null +++ b/.github/workflows/build-electron.yml @@ -0,0 +1,91 @@ +name: Electron App + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, macos-15, windows-2025] + steps: + - name: Force LF line endings + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - uses: actions/checkout@v4.2.2 + with: + submodules: recursive + + - name: Use Node.js + uses: actions/setup-node@v4.4.0 + with: + node-version: 22.x + + - name: Install dbus on Ubuntu + if: ${{ runner.os == 'Linux' }} + run: | + sudo apt-get update -q + sudo apt-get install -y libdbus-1-dev + + - name: Install webbluetooth + working-directory: api/webbluetooth + run: | + npm ci + npm run build:all + + - name: Install meshtastic-js + working-directory: api/meshtastic-js + run: | + npm ci + npm run build + + - name: Install UI dependencies + working-directory: ui + run: npm ci + + - name: Install API dependencies + working-directory: api + run: npm ci + + - name: Install Electron dependencies + working-directory: electron + run: npm ci + + - name: Build UI + working-directory: ui + run: | + npm run build + + - name: Build API + working-directory: api + run: | + npm run build + + - name: Set build arch + id: set_arch + shell: bash + run: | + if [[ "${{ runner.os }}" == "Windows" ]]; then + echo "arch=win" >> $GITHUB_OUTPUT + elif [[ "${{ runner.os }}" == "macOS" ]]; then + echo "arch=mac" >> $GITHUB_OUTPUT + else + echo "arch=linux" >> $GITHUB_OUTPUT + fi + + - name: Build Electron app + working-directory: electron + run: npm run build:${{ steps.set_arch.outputs.arch }} + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: electron-build-${{ matrix.os }} + path: electron/dist/ diff --git a/.gitignore b/.gitignore index 34b4b15..e8107de 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules .env .prettierrc.yaml .store +.DS_Store .vscode api/dist api/static diff --git a/electron/electron-builder-config.js b/electron/electron-builder-config.js index 234701a..fde5ba6 100644 --- a/electron/electron-builder-config.js +++ b/electron/electron-builder-config.js @@ -2,6 +2,16 @@ var pjson = require('./package.json') let channel = pjson.version.match(/-(?\w*).*/)?.groups?.channel let channelString = channel ? `-${channel}` : '' +const winSigningOptions = { + signingHashAlgorithms: ['sha256'], + publisherName: ['Affirmatech Inc.', 'Affirmatech Incorporated'], + signAndEditExecutable: true, + verifyUpdateCodeSignature: true, + certificateSubjectName: 'Affirmatech Incorporated' +}; + +const enableWinSigning = process.env.ENABLE_WIN_SIGNING === 'true'; + /** * @type {import('electron-builder').Configuration} * @see https://www.electron.build/configuration/configuration @@ -25,11 +35,7 @@ const config = { win: { artifactName: '${name}' + channelString + '-${arch}.${ext}', executableName: 'MeshSense', - signingHashAlgorithms: ['sha256'], - publisherName: ['Affirmatech Inc.', 'Affirmatech Incorporated'], - signAndEditExecutable: true, - verifyUpdateCodeSignature: true, - certificateSubjectName: 'Affirmatech Incorporated' + ...(enableWinSigning ? winSigningOptions : {}) }, nsis: { artifactName: '${name}' + channelString + '-${arch}.${ext}', @@ -47,6 +53,12 @@ const config = { { NSDocumentsFolderUsageDescription: "Application requests access to the user's Documents folder." } + ], + target: [ + { + target: 'dmg', + arch: ['universal'], + } ] }, dmg: {