-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ac5fbeb
Showing
67 changed files
with
28,796 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
name: Build Electron App | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build-macos: | ||
runs-on: macos-latest | ||
env: | ||
APPLE_ID: ${{ secrets.APPLE_ID }} | ||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | ||
APPLE_DEVELOPER_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }} | ||
DEBUG: electron-osx-sign*,electron-notarize* | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install signing certificate | ||
run: | | ||
KEYCHAIN_NAME=build.keychain | ||
KEYCHAIN_PASSWORD=$(openssl rand -base64 12) | ||
echo "Decode signing certificate..." | ||
echo "${{ secrets.SIGNING_CERTIFICATE }}" | base64 --decode > signing_certificate.p12 | ||
echo "${{ secrets.INSTALLING_CERTIFICATE }}" | base64 --decode > installing_certificate.p12 | ||
echo "Creating keychain..." | ||
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_NAME | ||
echo "Setting default keychain..." | ||
security default-keychain -s $KEYCHAIN_NAME | ||
echo "Unlocking keychain..." | ||
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_NAME | ||
echo "Importing certificate..." | ||
security import signing_certificate.p12 -k $KEYCHAIN_NAME -P "${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign | ||
security import installing_certificate.p12 -k $KEYCHAIN_NAME -P "${{ secrets.INSTALLING_CERTIFICATE_PASSWORD }}" -T /usr/bin/codesign -T /usr/bin/productbuild | ||
echo "Listing keychains..." | ||
security list-keychains -s $KEYCHAIN_NAME | ||
echo "Setting key partition list..." | ||
security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PASSWORD $KEYCHAIN_NAME | ||
working-directory: ./jccm | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20.10.0' | ||
|
||
- name: Install Python and set up venv | ||
run: | | ||
brew install [email protected] | ||
python3.9 -m venv myenv | ||
source myenv/bin/activate | ||
python3.9 -m ensurepip | ||
python3.9 -m pip install --upgrade pip | ||
python3.9 -m pip install setuptools | ||
working-directory: ./jccm | ||
|
||
- name: Install dependencies | ||
run: | | ||
source myenv/bin/activate | ||
npm install | ||
working-directory: ./jccm | ||
|
||
- name: Install appdmg | ||
run: | | ||
source myenv/bin/activate | ||
npm install --save-dev appdmg | ||
working-directory: ./jccm | ||
|
||
- name: Build and package (arm64 and x64) | ||
run: | | ||
source myenv/bin/activate | ||
npm run make | ||
working-directory: ./jccm | ||
|
||
- name: Notarize and Staple Packages | ||
run: | | ||
set -ex # Exit on error and print commands | ||
function notarize_and_verify() { | ||
architecture=$1 | ||
pkg_path="./out/make/jccm-darwin-$architecture.pkg" | ||
echo "Submitting $pkg_path for Notarization..." | ||
xcrun notarytool submit $pkg_path --keychain-profile jccm --wait | ||
echo "Stapling the Notarization Ticket to $pkg_path..." | ||
xcrun stapler staple $pkg_path | ||
echo "Verifying the Notarization of $pkg_path..." | ||
spctl -a -t install -vv $pkg_path | ||
} | ||
# Log in to Notarytool | ||
echo "Storing notary credentials..." | ||
xcrun notarytool store-credentials jccm --apple-id $APPLE_ID --team-id ${APPLE_DEVELOPER_TEAM_ID} --password ${APPLE_APP_SPECIFIC_PASSWORD} | ||
# Notarize and verify for both architectures | ||
notarize_and_verify "arm64" | ||
notarize_and_verify "x64" | ||
set +x # Stop printing commands | ||
working-directory: ./jccm | ||
|
||
- name: Upload macOS artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: macos-installers | ||
path: | | ||
./jccm/out/make/*.dmg | ||
./jccm/out/make/*.pkg | ||
build-windows: | ||
needs: build-macos | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20.10.0' | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
working-directory: ./jccm | ||
|
||
- name: Build and package (x64) | ||
run: npm run make -- --platform=win32 --arch=x64 | ||
working-directory: ./jccm | ||
|
||
- name: Upload windows artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: windows-installers | ||
path: | | ||
./jccm/out/make/squirrel.windows/x64/*.exe | ||
./jccm/out/make/squirrel.windows/x64/*.msi | ||
release: | ||
needs: [build-macos, build-windows] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Read version from package.json | ||
run: echo "VERSION=$(jq -r '.version' ./jccm/package.json)" >> $GITHUB_ENV | ||
|
||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: ./installers | ||
|
||
- name: Install GitHub CLI | ||
run: sudo apt-get install gh | ||
|
||
- name: Check for existing release and delete if it exists | ||
run: | | ||
if gh release view ${{ env.VERSION }}; then | ||
gh release delete ${{ env.VERSION }} --yes | ||
fi | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.VERSION }} | ||
release_name: 'Release ${{ env.VERSION }}' | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Assets | ||
run: | | ||
find ./installers -type f -exec echo "Uploading {}..." \; -exec gh release upload ${{ env.VERSION }} "{}" --clobber \; | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Simon Rho | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"presets": ["@babel/preset-env", "@babel/preset-react"] | ||
} | ||
|
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
const path = require('path'); | ||
|
||
const { FusesPlugin } = require('@electron-forge/plugin-fuses'); | ||
const { FuseV1Options, FuseVersion } = require('@electron/fuses'); | ||
|
||
console.log(`Current working directory: ${process.cwd()}`); | ||
|
||
const entitlements = '/Users/srho/electron-test/juniper-jccm-project/jccm/entitlements.plist'; | ||
module.exports = { | ||
packagerConfig: { | ||
asar: true, | ||
icon: './assets/icons/AppIcon', // Path without the extension | ||
osxSign: { | ||
'hardened-runtime': true, | ||
}, | ||
osxNotarize: { | ||
appleId: process.env.APPLE_ID, | ||
appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD, | ||
teamId: process.env.APPLE_DEVELOPER_TEAM_ID, | ||
}, | ||
}, | ||
rebuildConfig: {}, | ||
makers: [ | ||
{ | ||
name: '@electron-forge/maker-pkg', | ||
config: { | ||
identity: 'Developer ID Installer: Simon Rho (9B54K458K9)', | ||
overwrite: true, | ||
out: path.join(__dirname, 'out/make/darwin-arm64'), | ||
name: 'jccm-darwin-arm64', | ||
icon: path.join(__dirname, 'assets/icons/AppIcon.icns'), // Use the same icon as for DMG | ||
arch: 'arm64' | ||
} | ||
}, | ||
{ | ||
name: '@electron-forge/maker-pkg', | ||
config: { | ||
identity: 'Developer ID Installer: Simon Rho (9B54K458K9)', | ||
overwrite: true, | ||
out: path.join(__dirname, 'out/make/darwin-x64'), | ||
name: 'jccm-darwin-x64', | ||
icon: path.join(__dirname, 'assets/icons/AppIcon.icns'), // Use the same icon as for DMG | ||
arch: 'x64' | ||
} | ||
}, | ||
{ | ||
name: '@electron-forge/maker-squirrel', | ||
config: { | ||
iconUrl: `file://${path.resolve(__dirname, 'assets/icons/AppIcon.ico')}`, // Local file URL for Windows | ||
setupIcon: path.join(__dirname, 'assets/icons/AppIcon.ico'), // Path to the .ico file for Windows | ||
overwrite: true, | ||
out: path.join(__dirname, 'out/make/windows-x64'), | ||
name: 'jccm-windows-x64-setup', | ||
arch: 'x64', // Architecture for Windows | ||
// loadingGif: path.resolve(__dirname, 'assets/loading.gif'), // Path to a loading GIF | ||
setupExe: 'jccm-windows-x64-setup.exe', // Name for the setup executable | ||
setupMsi: 'jccm-windows-x64-setup.msi', // Name for the MSI installer | ||
}, | ||
}, | ||
{ | ||
name: '@electron-forge/maker-deb', | ||
config: { | ||
arch: 'x64', // Architecture for Linux .deb | ||
icon: path.join(__dirname, 'assets/icons/AppIcon.png'), // Icon for Linux .deb (should be a PNG) | ||
overwrite: true, | ||
out: path.join(__dirname, 'out/make/linux-deb-x64'), | ||
name: 'jccm-linux-deb-x64', | ||
}, | ||
}, | ||
{ | ||
name: '@electron-forge/maker-rpm', | ||
config: { | ||
arch: 'x64', // Architecture for Linux .rpm | ||
icon: path.join(__dirname, 'assets/icons/AppIcon.png'), // Icon for Linux .rpm (should be a PNG) | ||
overwrite: true, | ||
out: path.join(__dirname, 'out/make/linux-rpm-x64'), | ||
name: 'jccm-linux-rpm-x64', | ||
}, | ||
}, | ||
{ | ||
name: '@electron-forge/maker-dmg', | ||
config: { | ||
icon: path.join(__dirname, 'assets/icons/AppIcon.icns'), // Icon for macOS DMG | ||
overwrite: true, | ||
format: 'ULFO', // Optional: Customize DMG format | ||
out: path.join(__dirname, 'out/make/darwin-arm64'), | ||
name: 'jccm-darwin-arm64', | ||
arch: 'arm64', | ||
}, | ||
}, | ||
{ | ||
name: '@electron-forge/maker-dmg', | ||
config: { | ||
icon: path.join(__dirname, 'assets/icons/AppIcon.icns'), // Icon for macOS DMG | ||
overwrite: true, | ||
format: 'ULFO', // Optional: Customize DMG format | ||
out: path.join(__dirname, 'out/make/darwin-x64'), | ||
name: 'jccm-darwin-x64', | ||
arch: 'x64', | ||
}, | ||
}, | ||
], | ||
plugins: [ | ||
{ | ||
name: '@electron-forge/plugin-auto-unpack-natives', | ||
config: {}, // No specific configuration needed | ||
}, | ||
{ | ||
name: '@electron-forge/plugin-webpack', | ||
config: { | ||
loggerPort: 9001, // conflicts with zscaler client using tcp port 9000 | ||
mainConfig: './webpack.main.config.js', | ||
renderer: { | ||
config: './webpack.renderer.config.js', | ||
entryPoints: [ | ||
{ | ||
html: './src/index.html', | ||
js: './src/renderer.js', | ||
name: 'main_window', | ||
preload: { | ||
js: './src/preload.js', | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
new FusesPlugin({ | ||
version: FuseVersion.V1, | ||
[FuseV1Options.RunAsNode]: false, | ||
[FuseV1Options.EnableCookieEncryption]: true, | ||
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false, | ||
[FuseV1Options.EnableNodeCliInspectArguments]: false, | ||
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, | ||
[FuseV1Options.OnlyLoadAppFromAsar]: true, | ||
}), | ||
], | ||
}; |
Oops, something went wrong.