Reorganize NPM scripts, update workflows

This commit is contained in:
Marquis Kurt 2020-07-02 12:20:45 -04:00
parent cd3147b2ce
commit d1a70faf09
No known key found for this signature in database
GPG Key ID: 725636D259F5402D
10 changed files with 183 additions and 158 deletions

View File

@ -3,17 +3,35 @@ name: Build Linux Client
on: [push, pull_request]
jobs:
build_linux:
runs-on: ubuntu-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Install dependencies and build
run: |
npm install
npm run build --if-present
npm run build-desktop-linux
build_linux:
runs-on: ubuntu-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Change desktop field
run: |
from json import load, dump
json_dict = {}
with open('public/config.json', 'r') as file:
json_dict = load(file)
json_dict["location"] = "desktop"
with open('public/config.json', 'w+') as out:
dump(json_dict, out)
- name: Install dependencies and build
run: |
npm install
npm run build --if-present
npm run build:linux
- name: Upload Linux executables
uses: actions/upload-artifact@v1
if: success()
with:
name: "Linux executables (output dir)"
path: dist

View File

@ -3,46 +3,64 @@ name: Build macOS Client
on: [push, pull_request]
jobs:
build_darwin:
runs-on: macos-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Install certificates and entitlements
if: github.actor == 'alicerunsonfedora' || github.actor == 'Nomad1556' || github.actor == 'audmaxwell'
run: |
echo "Downloading certificates and profiles..."
echo "$ascCertificates" > certs.b64
echo "$ascMasProfile" > mas.b64
echo "$ascMacProfile" > mac.b64
echo "$ascEntitlementsMas" > entmas.b64
echo "$ascEntitlementsMac" > entmac.b64
echo "$ascInfoPlist" > info.b64
build_darwin:
runs-on: macos-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Install certificates and entitlements
if: github.actor == 'alicerunsonfedora' || github.actor == 'Nomad1556' || github.actor == 'audmaxwell'
run: |
echo "Downloading certificates and profiles..."
echo "$ascCertificates" > certs.b64
echo "$ascMasProfile" > mas.b64
echo "$ascMacProfile" > mac.b64
echo "$ascEntitlementsMas" > entmas.b64
echo "$ascEntitlementsMac" > entmac.b64
echo "$ascInfoPlist" > info.b64
echo "Installing certificates and profiles..."
base64 --decode certs.b64 > Certificates.p12
base64 --decode mas.b64 > desktop/embedded.provisionprofile
base64 --decode mac.b64 > desktop/nonmas.provisionprofile
base64 --decode entmas.b64 > desktop/entitlements.mas.plist
base64 --decode entmac.b64 > desktop/entitlements.mac.plist
base64 --decode info.b64 > desktop/info.plist
security add-generic-password -a "appleseed@marquiskurt.net" -w "$ascPassword" -s "AC_PASSWORD"
sudo security import Certificates.p12 -P "$ascCertsPassword" -k /Library/Keychains/System.keychain
env:
ascPassword: ${{ secrets.ASC_PASSWORD }}
ascCertificates: ${{ secrets.ASC_CERTS }}
ascCertsPassword: ${{ secrets.ASC_CERTS_PASSWORD }}
ascMacProfile: ${{ secrets.ASC_NONMAS_PROFILE }}
ascMasProfile: ${{ secrets.ASC_EMBEDDED_PROFILE }}
ascEntitlementsMas: ${{ secrets.ASC_MAS_ENTITLEMENTS }}
ascEntitlementsMac: ${{ secrets.ASC_MAC_ENTITLEMENTS }}
ascInfoPlist: ${{ secrets.ASC_INFO_PLIST }}
- name: Install dependencies and build
run: |
npm install
npm run build --if-present
npm run build-desktop-darwin-nosign
echo "Installing certificates and profiles..."
base64 --decode certs.b64 > Certificates.p12
base64 --decode mas.b64 > desktop/embedded.provisionprofile
base64 --decode mac.b64 > desktop/nonmas.provisionprofile
base64 --decode entmas.b64 > desktop/entitlements.mas.plist
base64 --decode entmac.b64 > desktop/entitlements.mac.plist
base64 --decode info.b64 > desktop/info.plist
security add-generic-password -a "appleseed@marquiskurt.net" -w "$ascPassword" -s "AC_PASSWORD"
sudo security import Certificates.p12 -P "$ascCertsPassword" -k /Library/Keychains/System.keychain
env:
ascPassword: ${{ secrets.ASC_PASSWORD }}
ascCertificates: ${{ secrets.ASC_CERTS }}
ascCertsPassword: ${{ secrets.ASC_CERTS_PASSWORD }}
ascMacProfile: ${{ secrets.ASC_NONMAS_PROFILE }}
ascMasProfile: ${{ secrets.ASC_EMBEDDED_PROFILE }}
ascEntitlementsMas: ${{ secrets.ASC_MAS_ENTITLEMENTS }}
ascEntitlementsMac: ${{ secrets.ASC_MAC_ENTITLEMENTS }}
ascInfoPlist: ${{ secrets.ASC_INFO_PLIST }}
- name: Change desktop field
run: |
from json import load, dump
json_dict = {}
with open('public/config.json', 'r') as file:
json_dict = load(file)
json_dict["location"] = "desktop"
with open('public/config.json', 'w+') as out:
dump(json_dict, out)
- name: Install dependencies and build
run: |
npm install
npm run build --if-present
npm run build:mac-unsigned
- name: Upload macOS (unsigned) bundle
uses: actions/upload-artifact@v1
if: success()
with:
name: "macOS bundle (output dir)"
path: dist

View File

@ -3,36 +3,36 @@ name: Build Windows Client
on: [push, pull_request]
jobs:
build_win:
runs-on: windows-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Change desktop field
run: |
from json import load, dump
build_win:
runs-on: windows-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Change desktop field
run: |
from json import load, dump
json_dict = {}
with open('public/config.json', 'r') as file:
json_dict = load(file)
json_dict["location"] = "desktop"
json_dict = {}
with open('public/config.json', 'r') as file:
json_dict = load(file)
with open('public/config.json', 'w+') as out:
dump(json_dict, out)
shell: python
- name: Install dependencies and build
run: |
npm install
npm run build --if-present
npm run build-desktop-win
- name: Upload Windows executable
uses: actions/upload-artifact@v1
if: success()
with:
name: 'Windows executable (output dir)'
path: dist
json_dict["location"] = "desktop"
with open('public/config.json', 'w+') as out:
dump(json_dict, out)
shell: python
- name: Install dependencies and build
run: |
npm install
npm run build --if-present
npm run build:win
- name: Upload Windows executable
uses: actions/upload-artifact@v1
if: success()
with:
name: "Windows executable (output dir)"
path: dist

View File

@ -1,26 +0,0 @@
# name: Create issue on Jira
# on:
# issues:
# types: [opened]
# jobs:
# jira:
# runs-on: ubuntu-latest
# steps:
# - name: Jira Login
# id: login
# uses: atlassian/gajira-login@v2.0.0
# env:
# JIRA_BASE_URL: "https://hyperspacedev.atlassian.net"
# JIRA_USER_EMAIL: software@marquiskurt.net
# JIRA_API_TOKEN: ${{ secrets.JIRA_TOKEN }}
# - name: Jira Create issue
# id: create
# uses: atlassian/gajira-create@v2.0.0
# with:
# project: HD
# issuetype: Unsorted
# summary: ${{ github.event.issue.title }}
# description: ${{ github.event.issue.body }}

View File

@ -3,18 +3,18 @@ name: Prettier
on: [pull_request]
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Install dependencies and run Prettier
run: |
npm install
npm run check-prettier
env:
CI: true
prettier:
runs-on: ubuntu-latest
steps:
- name: Clone source code
uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: Install dependencies and run Prettier
run: |
npm install
npm run test:prettier
env:
CI: true

5
.gitignore vendored
View File

@ -72,4 +72,7 @@ desktop/*.plist
desktop/*.provisionprofile
# JetBrains IDEA directory
.idea/
.idea/
# Pesky macOS files
**/**.DS_Store

View File

@ -60,8 +60,8 @@ npm install
Run any of the following scripts to test:
- `npm start` - Starts a local server hosted at https://localhost:3000.
- `npm run electrify` - Builds a copy of the source code and then runs the app through Electron. Ensure that the `location` key in `config.json` points to `"desktop"` before running this.
- `npm run electrify-nobuild` - Similar to `electrify` but doesn't build the project before running.
- `npm run electron:build` - Builds a copy of the source code and then runs the app through Electron. Ensure that the `location` key in `config.json` points to `"desktop"` before running this.
- `npm run electron:prebuilt` - Similar to `electron:build` but doesn't build the project before running.
The `location` key in `config.json` can take the following values during testing:
@ -84,17 +84,18 @@ The built files will be available under `build` as static files that can be host
You can run any of the following commands to build a release for the desktop:
- `npm run build-desktop`: Builds the desktop apps for all platforms (eg. Windows, macOS, Linux). Will run `npm run build` before building.
- `npm run build-desktop-win`: Builds the desktop app for Windows without running `npm run build`.
- `npm run build-desktop-darwin`: Builds the desktop apps for macOS (eg. disk image, Mac App Store) without running `npm run build`. See the details below for more information on building for macOS.
- `npm run build-desktop-linux`: Builds the desktop apps for Linux (eg. Debian package, AppImage, and Snap) without running `npm run build`.
- `npm run build-desktop-linux-select`: Builds the desktop app for Linux without running `npm run build`. _Target is required as a parameter._
- `npm run build:desktop-all`: Builds the desktop apps for all platforms (eg. Windows, macOS, Linux). Will run `npm run build` before building.
- `npm run build:win`: Builds the desktop app for Windows without running `npm run build`.
- `npm run build:mac`: Builds the desktop apps for macOS without running `npm run build`. See the details below for more information on building for macOS.
- `npm run build:mas`: Builds the desktop apps for the Mac App Store without running `npm run build`. See the details below for more information on building for macOS.
- `npm run build:linux`: Builds the desktop apps for Linux (eg. Debian package, AppImage, and Snap) without running `npm run build`.
- `npm run build:linux-select-targets`: Builds the desktop app for Linux without running `npm run build`. _Targets are required as parameters._
The built files will be available under `dist` that can be uploaded to your app distributor or website.
#### Building for macOS
More recent version of macOS require that the Hyperspace desktop app be both digitally code-signed and notarized (uploaded to Apple to check for malware). Hyperspace includes the tools necessary to automate this process when building the macOS version either by `npm run build-desktop` or by `npm run build-desktop-darwin`.
More recent version of macOS require that the Hyperspace desktop app be both digitally code-signed and notarized (uploaded to Apple to check for malware). Hyperspace includes the tools necessary to automate this process when building the macOS version either by `npm run build:desktop-all` or by `npm run build:mac`.
Make sure you have your provisioning profiles for the Mac App Store (`embedded.provisionprofile`) and standard distribution (`nonmas.provisionprofile`) in the `desktop` directory. These provision profiles can be obtained through Apple Developer. You'll also need to create entitlements files in the `desktop` directory that list the following entitlements for your app:
@ -119,7 +120,7 @@ It is also recommended to add the `com.apple.security.applications-groups` entry
You'll also want to modify the `notarize.js` file to change the details from the default to your App Store Connect account details and app identifier.
> ⚠️ **Warning**: The package.json file also includes the `build-desktop-darwin-nosign` script. This script is specifically intended for automated systems that cannot run notarization (Azure Pipelines, GitHub Actions, etc.). _Do not use this command to build production-ready versions of Hyperspace_.
> ⚠️ **Warning**: The package.json file also includes the `build:mac-unsigned` script. This script is specifically intended for automated systems that cannot run notarization (Azure Pipelines, GitHub Actions, etc.). _Do not use this command to build production-ready versions of Hyperspace_.
## Licensing and Credits

View File

@ -2,9 +2,9 @@
# Hyperspace Desktop MAS Build Config
# (C) 2020 Hyperspace Developers. Licensed under NPLv4.
#
# The following configuration file is used to configure the Mac App Store
# builds of Hyperspace Desktop since Electron Builder runs into previous
# issues.
# The following configuration file is used to configure the Mac App Store builds of Hyperspace
# Desktop. For building cross-platform apps without submitting to the Mac App Store, modify the
# standard.yml config file.
#
appId: net.marquiskurt.hyperspace
@ -12,6 +12,14 @@ afterSign: desktop/notarize.js
directories:
buildResources: desktop
# The bundleVersion and bundleShortVersion keys in this config correspond to builds in the
# Mac App Store. If you are attempting to upload a new build of the same app version to the
# Mac App Store, change the bundle version. The bundle short version should be the same as
# the app version seen in config.json and package.json.
#
# If you are submitting a new app version entirely, make sure the bundle version and short
# version match accordingly, except in cases where the app version is the same version as an
# older Mac App Store build.
mac:
bundleVersion: "1.1.5"
bundleShortVersion: "1.1.3"
@ -22,6 +30,10 @@ mac:
hardenedRuntime: false
gatekeeperAssess: false
# Note that you will need the proper entitlements files for the following keys below. Refer to
# the Hyperspace Desktop documentation regarding what keys will need to be inserted into the
# entitlements files:
# https://hyperspace.marquiskurt.net/docs/desktop-build-desktop.html
mas:
entitlements: desktop/entitlements.mas.plist
entitlementsInherit: desktop/entitlements.mas.inherit.plist

View File

@ -2,8 +2,8 @@
# Hyperspace Desktop Build Config
# (C) 2020 Hyperspace Developers. Licensed under NPLv4.
#
# The following configuration file is used to configure all desktop app builds,
# including the standard macOS builds. For the Mac App Store, mas.yml is used.
# The following configuration file is used to configure and build the cross-platforms apps,
# excluding the Mac App Store build. For the Mac App Store build, modify the mas.yml file.
#
appId: net.marquiskurt.hyperspace
@ -11,7 +11,6 @@ afterSign: desktop/notarize.js
directories:
buildResources: desktop
# For the standard macOS Distribution
mac:
category: public.app-category.social-networking
icon: desktop/app.icns
@ -28,7 +27,7 @@ win:
linux:
target: ["${@:1}"]
icon: desktop/linux
icon: linux
category: Network
snap:

View File

@ -47,20 +47,20 @@
"main": "public/electron.js",
"scripts": {
"start": "react-scripts start",
"electrify": "npm run build; electron .",
"electrify-nobuild": "electron .",
"build": "react-scripts build",
"create-mac-icon": "cd desktop; iconutil -c icns app.iconset; cd ..",
"build-desktop": "npm run build; npm run create-mac-icon; electron-builder -p 'never' -mwl deb AppImage snap -c ebuild/standard.yml",
"build-desktop-win": "electron-builder -p 'never' -w -c ebuild/standard.yml",
"build-desktop-darwin": "npm run create-mac-icon; electron-builder -p 'never' -m -c ebuild/standard.yml",
"build-desktop-mas": "npm run create-mac-icon; electron-builder -p 'never' -m mas -c ebuild/mas.yml",
"build-desktop-darwin-nosign": "npm run create-mac-icon; electron-builder -p 'never' -m dmg -c.mac.identity=null -c.afterSign=\"desktop/donothing.js\" -c ebuild/standard.yml",
"build-desktop-linux": "electron-builder -p 'never' -l deb AppImage snap -c ebuild/standard.yml",
"build-desktop-linux-select": "electron-builder -p 'never' -c ebuild/standard.yml -l ",
"check-prettier": "prettier --check src/**/**.tsx",
"test": "react-scripts test",
"eject": "react-scripts eject"
"test:prettier": "prettier --check src/**/**.tsx",
"eject": "react-scripts eject",
"electron:build": "npm run build; electron .",
"electron:prebuilt": "electron .",
"build": "react-scripts build",
"build:icns": "iconutil -c icns desktop/app.iconset -o desktop/app.icns",
"build:desktop-all": "npm run build; npm run build:icns; electron-builder -p 'never' -mwl deb AppImage snap -c ebuild/standard.yml",
"build:win": "electron-builder -p 'never' -w -c ebuild/standard.yml",
"build:mac": "npm run build:icns; electron-builder -p 'never' -m -c ebuild/standard.yml",
"build:mac-unsigned": "npm run build:icns; electron-builder -p 'never' -m dmg -c.mac.identity=null -c.afterSign=\"desktop/donothing.js\" -c ebuild/standard.yml",
"build:mas": "npm run build:icns; electron-builder -p 'never' -m mas -c ebuild/mas.yml",
"build:linux": "electron-builder -p 'never' -l deb AppImage snap -c ebuild/standard.yml",
"build:linux-select-targets": "electron-builder -p 'never' -c ebuild/standard.yml -l "
},
"eslintConfig": {
"extends": "react-app"