Added github actions building
This commit is contained in:
parent
4c5139d01e
commit
5e85253920
|
@ -0,0 +1,74 @@
|
|||
|
||||
name: Loki Electron Wallet Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- build
|
||||
- github-actions
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [windows-latest, macos-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout git repo
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Install node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: "11.9.0"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Download lokid binaries
|
||||
run: node ./build/download-binaries.js
|
||||
|
||||
- name: Extract zip binaries
|
||||
if: runner.os != 'Linux'
|
||||
run: unzip latest.zip
|
||||
shell: bash
|
||||
working-directory: ./downloads
|
||||
|
||||
- name: Extract xz binaries
|
||||
if: runner.os == 'Linux'
|
||||
run: tar -xf latest.xz
|
||||
shell: bash
|
||||
working-directory: ./downloads
|
||||
|
||||
- name: Move lokid binaries
|
||||
run: |
|
||||
find ./downloads -type f -name "lokid" -exec cp '{}' ./bin \;
|
||||
find ./downloads -type f -name "loki-wallet-rpc" -exec cp '{}' ./bin \;
|
||||
shell: bash
|
||||
|
||||
- name: Build window and linux binaries
|
||||
if: runner.os != 'macOS'
|
||||
run: npm run build
|
||||
|
||||
- name: Build mac binaries
|
||||
if: runner.os == 'macOS'
|
||||
run: npm run build
|
||||
env:
|
||||
CSC_LINK: ${{ secrets.MAC_CERTIFICATE }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
|
||||
SIGNING_APPLE_ID: ${{ secrets.SIGNING_APPLE_ID }}
|
||||
SIGNING_APP_PASSWORD: ${{ secrets.SIGNING_APP_PASSWORD }}
|
||||
SIGNING_TEAM_ID: ${{ secrets.SIGNING_TEAM_ID }}
|
||||
|
||||
- name: Remove un-needed artifacts
|
||||
run: rm -r -- ./*/
|
||||
shell: bash
|
||||
working-directory: ./dist/electron-mat/Packaged
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{ runner.OS }}
|
||||
path: dist/electron-mat/Packaged
|
|
@ -27,3 +27,5 @@ bin/*
|
|||
!bin/.gitkeep
|
||||
|
||||
.env
|
||||
|
||||
/downloads
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# Building
|
||||
|
||||
Building loki electron wallet binaries is done using github actions. Windows and linux binaries will build right out of the box but there are some extra steps needed for Mac OS
|
||||
|
||||
## Mac OS
|
||||
|
||||
The build script for Mac OS requires you to have a valid `Developer ID Application` certificate. Without this the build script cannot sign and notarize the mac binary which is needed for Catalina 10.15 and above.
|
||||
If you would like to disable this then comment out `"afterSign": "build/notarize.js",` in package.json.
|
||||
|
||||
You will also need an [App-specific password](https://support.apple.com/en-al/HT204397) for the apple account you wish to notarize with
|
||||
|
||||
### Setup
|
||||
|
||||
Once you have your `Developer ID Application` you need to export it into a `.p12` file. Keep a note of the password used to encrypt this file as it will be needed later.
|
||||
|
||||
We need to Base64 encode this file, so run the following command:
|
||||
|
||||
```
|
||||
base64 -i certificate.p12 -o encoded.txt
|
||||
```
|
||||
|
||||
#### On GitHub:
|
||||
|
||||
1. Navigate to the main page of the repository.
|
||||
2. Under your repository name, click **Settings**.
|
||||
3. In the left sidebar, click **Secrets**.
|
||||
4. Add the following secrets:
|
||||
1. Certificate
|
||||
* Name: `MAC_CERTIFICATE`
|
||||
* Value: The encoded Base64 certificate
|
||||
2. Certificate password
|
||||
* Name: `MAC_CERTIFICATE_PASSWORD`
|
||||
* Value: The password that was set when the certificate was exported.
|
||||
3. Apple ID
|
||||
* Name: `SIGNING_APPLE_ID`
|
||||
* Value: The apple id (email) to use for signing
|
||||
4. Apple Password
|
||||
* Name: `SIGNING_APP_PASSWORD`
|
||||
* Value: The app-specific password that was generated for the apple id
|
||||
5. Team ID (Optional)
|
||||
* Name: `SIGNING_TEAM_ID`
|
||||
* Value: The apple team id if you're sigining the application for a team
|
|
@ -0,0 +1,39 @@
|
|||
const axios = require("axios").default
|
||||
const fs = require("fs-extra")
|
||||
const path = require("path")
|
||||
|
||||
async function download () {
|
||||
const { platform } = process
|
||||
const repoUrl = "https://api.github.com/repos/loki-project/loki/releases/latest"
|
||||
try {
|
||||
const pwd = process.cwd()
|
||||
const downloadDir = path.join(pwd, "downloads")
|
||||
await fs.ensureDir(downloadDir)
|
||||
|
||||
const { data } = await axios.get(repoUrl)
|
||||
const url = (data.assets || [])
|
||||
.map(asset => asset["browser_download_url"])
|
||||
.find(url => {
|
||||
if (platform === "darwin") {
|
||||
return url.includes("osx") || url.includes("mac")
|
||||
} else if (platform === "win32") {
|
||||
return url.includes("win") || url.includes("windows")
|
||||
}
|
||||
return url.includes("linux")
|
||||
})
|
||||
|
||||
if (!url) { throw new Error("Download url not found for " + process) }
|
||||
console.log("Downloading binary at url: " + url)
|
||||
|
||||
const extension = path.extname(url)
|
||||
const filePath = path.join(downloadDir, "latest" + extension)
|
||||
const { data: artifact } = await axios.get(url, { responseType: "stream" })
|
||||
artifact.pipe(fs.createWriteStream(filePath))
|
||||
console.log("Downloaded binary to: " + filePath)
|
||||
} catch (err) {
|
||||
console.error("Failed to download file: " + err)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
download()
|
|
@ -4,22 +4,43 @@ const { notarize } = require("electron-notarize")
|
|||
/*
|
||||
Pre-requisites: https://github.com/electron/electron-notarize#prerequisites
|
||||
1. Generate an app specific password
|
||||
2. Add ELECTRON_WALLET_APPLE_ID, ELECTRON_WALLET_APP_PASSWORD, ELECTRON_WALLET_TEAM_ID to .env file in the root directory (where quasar.conf.js is located)
|
||||
2. Add SIGNING_APPLE_ID, SIGNING_APP_PASSWORD, SIGNING_TEAM_ID to .env file in the root directory (where quasar.conf.js is located)
|
||||
*/
|
||||
|
||||
/*
|
||||
Notarizing: https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
|
||||
*/
|
||||
|
||||
const log = msg => console.log(`\n${msg}`)
|
||||
const isEmpty = v => !v || v.length === 0
|
||||
|
||||
exports.default = async function notarizing (context) {
|
||||
const { electronPlatformName, appOutDir } = context
|
||||
if (electronPlatformName !== "darwin") {
|
||||
return
|
||||
}
|
||||
log("Notarizing mac application")
|
||||
|
||||
const appName = context.packager.appInfo.productFilename
|
||||
const {
|
||||
SIGNING_APPLE_ID,
|
||||
SIGNING_APP_PASSWORD,
|
||||
SIGNING_TEAM_ID
|
||||
} = process.env
|
||||
|
||||
return notarize({
|
||||
if (isEmpty(SIGNING_APPLE_ID) || isEmpty(SIGNING_APP_PASSWORD)) {
|
||||
log(
|
||||
"SIGNING_APPLE_ID or SIGNING_APP_PASSWORD not set.\nTerminating noratization."
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const options = {
|
||||
appBundleId: "com.loki-project.electron-wallet",
|
||||
appPath: `${appOutDir}/${appName}.app`,
|
||||
appleId: process.env.ELECTRON_WALLET_APPLE_ID,
|
||||
appleIdPassword: process.env.ELECTRON_WALLET_APP_PASSWORD,
|
||||
ascProvider: process.env.ELECTRON_WALLET_TEAM_ID
|
||||
})
|
||||
appleId: SIGNING_APPLE_ID,
|
||||
appleIdPassword: SIGNING_APP_PASSWORD
|
||||
}
|
||||
if (!isEmpty(SIGNING_TEAM_ID)) options.ascProvider = SIGNING_TEAM_ID
|
||||
return notarize(options)
|
||||
}
|
||||
|
|
|
@ -191,8 +191,7 @@ module.exports = function (ctx) {
|
|||
},
|
||||
|
||||
mac: {
|
||||
// Zip seems to corrupt the app after unzipping. Ref: https://github.com/electron-userland/electron-builder/issues/3534
|
||||
target: ["7z"],
|
||||
target: ["dmg"],
|
||||
icon: "src-electron/icons/icon.icns",
|
||||
category: "public.app-category.finance",
|
||||
// Notarizing: https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
|
||||
|
@ -213,7 +212,7 @@ module.exports = function (ctx) {
|
|||
},
|
||||
|
||||
files: [
|
||||
"!build/notarize.js",
|
||||
"!build/*.js",
|
||||
"!.env"
|
||||
],
|
||||
|
||||
|
|
Loading…
Reference in New Issue