Skip to content

Commit

Permalink
ci: Build electron app via github release (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
aomafarag authored Mar 6, 2023
1 parent dd8ec7a commit a67fa6c
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 4 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-electron-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and release Electron app

on:
release:
types: [released]

jobs:
build-and-release:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

permissions:
contents: write

steps:
- name: Check out Git repository
uses: actions/checkout@v1

- name: Setup Node.js and NPM
uses: actions/setup-node@v1
with:
node-version: 16.9.1

- name: Run electron-builder
uses: samuelmeuli/action-electron-builder@e4b12cd06ddf023422f1ac4e39632bd76f6e6928
with:
package_root: electron
github_token: ${{ secrets.github_token }}

- name: Upload binaries to release
uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: |
electron/out/*.dmg*
electron/out/*.AppImage*
electron/out/*.exe*
electron/out/latest*.yml
4 changes: 2 additions & 2 deletions electron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ Scripts to package unified-auction frontend into os-native applications
### Development setup

1. Install dependencies via `npm i`
2. Build and copy frontend `npm run prebuild`
2. Build and copy frontend `npm run build`
3. Start electron in "electron development mode" `npm start` (note: the frontend will not be rebuild)

### Build a distributable app

1. Install dependencies via `npm i`
2. Build applications for the current platform via `npm run build` (will automatically run `npm run prebuild`)
2. Build applications for the current platform via `npm run distribute` (will run `npm run build`)
3. Built files will be available under the newly created `./out` directory
28 changes: 28 additions & 0 deletions electron/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
},
"scripts": {
"preinstall": "cd ../frontend && npm ci",
"prebuild": "(cd ../frontend && ENABLE_FILE_PROTOCOL=\"true\" npm run generate) && npx copyfiles -a -u 2 \"../frontend/dist/**/*\" .",
"build": "(cd ../frontend && cross-env ENABLE_FILE_PROTOCOL=true npm run generate) && npx copyfiles -a -u 2 \"../frontend/dist/**/*\" .",
"start": "electron .",
"build": "rm -rf out && electron-builder"
"distribute": "rm -rf dist out && npm run build && electron-builder"
},
"author": "SIDESTREAM GmbH",
"devDependencies": {
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"electron": "^22.1.0",
"electron-builder": "^23.6.0"
}
Expand Down

0 comments on commit a67fa6c

Please sign in to comment.