Skip to content

Commit

Permalink
Automatic build for macos (#59)
Browse files Browse the repository at this point in the history
* osx ?

* osx

* link

* small change download

* again

* see that way

* more

* wired

* removed auth

* remove env

* Revert "remove env"

This reverts commit 7a6f71f.

* Revert "removed auth"

This reverts commit 801767d.

* old style

* added mac

* direct

* direct changed

* fix

* I will write poem here

* finally build but its not the end :D

* too fast

* again

* shorter one :D

* and again

* single one

* full name

* download

* equal

* notarise strings

* notarize

* osx

* boring

* wiered once working once not

* removed token

* Try that one

* white spaces

* only osx

* disabled auth

* idk

* precision

* update packages

* boring

* osx

* idk

* parent 0c43412
author ArqTras <[email protected]> 1592164893 +0200
committer ArqTras <[email protected]> 1594853310 +0200

Revert "Update cs.js"

This reverts commit 0c43412.

osx ?

osx

link

small change download

again

see that way

more

wired

removed auth

remove env

Revert "remove env"

This reverts commit 7a6f71f.

Revert "removed auth"

This reverts commit 801767d.

old style

added mac

direct changed

fix

I will write poem here

finally build but its not the end :D

too fast

again

shorter one :D

and again

single one

full name

download

equal

notarise strings

notarize

osx

boring

wiered once working once not

removed token

Try that one

white spaces

only osx

disabled auth

idk

precision

update packages

boring

osx

idk

* show me some errors

* .

* try this one

* direct

* macos-10.14

* osx only

* hmm

* old style

* again
  • Loading branch information
ArqTras authored Jul 16, 2020
1 parent 86810c9 commit bef4e42
Show file tree
Hide file tree
Showing 5 changed files with 1,315 additions and 782 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-2016, ubuntu-latest]
os: [windows-2016, macos-latest, ubuntu-latest]

steps:
- name: Checkout git repo
Expand All @@ -27,18 +27,18 @@ jobs:
- name: Download Arqmad 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 gz binaries
if: runner.os == 'Linux'
run: tar -xf latest.gz
shell: bash
working-directory: ./downloads

- name: Extract zip binaries
if: runner.os != 'Linux'
run: unzip latest.zip
shell: bash
working-directory: ./downloads

- name: Move arqmad binaries
run: |
find ./downloads -type f -name "arqmad*" -exec cp '{}' ./bin \;
Expand All @@ -55,6 +55,17 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish mac binaries
if: runner.os == 'macOS'
run: npm run build
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: ${{ secrets.MAC_CERTIFICATE }}
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}
ELECTRON_WALLET_APPLE_ID: ${{ secrets.ELECTRON_WALLET_APPLE_ID }}
ELECTRON_WALLET_PASSWORD: ${{ secrets.ELECTRON_WALLET_PASSWORD }}
ELECTRON_WALLET_TEAM_ID: ${{ secrets.ELECTRON_WALLET_TEAM_ID }}

- name: Remove un-needed artifacts
run: rm -r -- ./*/
shell: bash
Expand Down
19 changes: 5 additions & 14 deletions build/download-binaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,25 @@ const fs = require("fs-extra")
const path = require("path")

async function download () {
const { platform, env } = process;
const { platform } = process
const repoUrl = "https://api.github.com/repos/arqma/arqma/releases/latest"
try {
const pwd = process.cwd()
const downloadDir = path.join(pwd, "downloads")
await fs.ensureDir(downloadDir)

const headers = {
"Content-Type": "application/json"
};
if (env.GH_TOKEN) {
headers.Authorisation = `Bearer ${env.GH_TOKEN}`;
}

const { data } = await axios.get(repoUrl, { headers });
const { name } = data
console.log("Latest release: " + name)

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")
return url.includes("osx-x64-v6.0.2.zip")
} else if (platform === "win32") {
return url.includes("win64") || url.includes("win64")
return url.includes("win64")
}
return url.includes("x86_64-linux-gnu-compat.tar.gz")
})

if (!url) { throw new Error("Download url not found for " + process) }
console.log("Downloading binary at url: " + url)

Expand Down
49 changes: 32 additions & 17 deletions build/notarize.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
require("dotenv").config()
const { notarize } = require("electron-notarize")
require("dotenv").config();
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)
*/

exports.default = async function notarizing (context) {
const { electronPlatformName, appOutDir } = context
if (electronPlatformName !== "darwin") {
return
}
/*
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 { ELECTRON_WALLET_APPLE_ID, ELECTRON_WALLET_PASSWORD, ELECTRON_WALLET_TEAM_ID } = process.env;

const appName = context.packager.appInfo.productFilename
if (isEmpty(ELECTRON_WALLET_APPLE_ID) || isEmpty(ELECTRON_WALLET_PASSWORD)) {
log("SIGNING_APPLE_ID or SIGNING_APP_PASSWORD not set.\nTerminating noratization.");
return;
}

return notarize({
appBundleId: "com.arqma.electron-wallet",
appPath: `${appOutDir}/${appName}.app`,
appleId: process.env.ELECTRON_WALLET_APPLE_ID,
appleIdPassword: process.env.ELECTRON_WALLET_PASSWORD,
ascProvider: process.env.ELECTRON_WALLET_TEAM_ID
})
}
const options = {
appBundleId: "com.arqma-project.electron-wallet",
appPath: `${appOutDir}/${appName}.app`,
appleId: ELECTRON_WALLET_APPLE_ID,
appleIdPassword: ELECTRON_WALLET_PASSWORD
};
if (!isEmpty(ELECTRON_WALLET_TEAM_ID)) options.ascProvider = ELECTRON_WALLET_TEAM_ID;
return notarize(options);
};
Loading

0 comments on commit bef4e42

Please sign in to comment.