Skip to content

assorted unreleased fixes and improvements #60

assorted unreleased fixes and improvements

assorted unreleased fixes and improvements #60

name: Build & Release
on:
push:
tags:
- '**'
pull_request:
branches:
- '**'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true
permissions:
id-token: write
contents: write
jobs:
build_mac:
name: Build Mac Installer
runs-on: macos-latest
steps:
- uses: Chia-Network/actions/clean-workspace@main
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node 18.16
uses: actions/setup-node@v3
with:
node-version: '18.16'
- name: Install Husky
run: npm install --save-dev husky
- name: install dmg-license
run: npm i dmg-license
- name: npm install
run: |
npm install
- name: Import Apple installer signing certificate
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }}
p12-password: ${{ secrets.APPLE_DEV_ID_APP_PASS }}
- name: Build electron app
env:
CSC_FOR_PULL_REQUEST: "true"
run: npm run electron:package:mac
- name: List contents of the dist directory
run: |
echo "Listing contents of the dist directory:"
ls -al ${{ github.workspace }}/dist/
- name: Find DMG file
id: find-dmg
run: |
DMG_FILE=$(find ${{ github.workspace }}/dist -type f -name '*.dmg')
echo "DMG_FILE=$DMG_FILE" >> $GITHUB_ENV
echo "Found DMG file: $DMG_FILE"
- name: Notarize with notary-tools action
uses: GuillaumeFalourd/notary-tools@v1
with:
product_path: ${{ env.DMG_FILE }}
apple_id: ${{ secrets.APPLE_NOTARIZE_USERNAME }}
password: ${{ secrets.APPLE_NOTARIZE_PASSWORD }}
team_id: ${{ secrets.APPLE_TEAM_ID }}
staple: 'true'
keychain_profile: ${{ secrets.APPLE_NOTARIZE_PASSWORD }}
- name: Upload Mac Installer
uses: actions/upload-artifact@v3
with:
name: sprout-ui-mac-installer
path: ${{ github.workspace }}/dist/*.dmg
build_windows:
name: Build Windows Installer
runs-on: windows-2019
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node 18.16
uses: actions/setup-node@v3
with:
node-version: '18.16'
- name: Install Husky
run: npm install --save-dev husky
- name: Ignore Husky where not compatible
run: npm pkg delete scripts.prepare
- name: npm install
run: |
node --version
npm install
- name: Build electron app
run: npm run electron:package:win
# Windows Code Signing
- name: Get installer name for signing
shell: bash
run: |
FILE=$(find dist -type f -maxdepth 1 -name '*.exe')
echo "Installer file is $FILE"
echo "INSTALLER_FILE=$FILE" >> "$GITHUB_ENV"
- name: Sign windows artifacts
uses: chia-network/actions/digicert/windows-sign@main
with:
sm_api_key: ${{ secrets.DIGI_CERT_SM_API_KEY }}
sm_client_cert_file_b64: ${{ secrets.DIGI_CERT_SM_CLIENT_CERT_FILE_B64 }}
sm_client_cert_password: ${{ secrets.DIGI_CERT_SM_CLIENT_CERT_PASSWORD }}
sm_code_signing_cert_sha1_hash: ${{ secrets.DIGI_CERT_SM_CODE_SIGNING_CERT_SHA1_HASH }}
file: '${{ github.workspace }}/${{ env.INSTALLER_FILE }}'
- name: Upload Windows Installer
uses: actions/upload-artifact@v3
with:
name: sprout-ui-windows-installer
path: '${{ github.workspace }}/${{ env.INSTALLER_FILE }}'
build_linux:
name: Build Linux Installer
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node 18.16
uses: actions/setup-node@v3
with:
node-version: '18.16'
- name: Install Husky
run: npm install --save-dev husky
- name: npm install
run: |
node --version
npm install
- name: Build electron app
run: npm run electron:package:linux
- name: Rename Linux installer to be standard format for apt
run: |
ORIGINAL=$(ls dist/*.deb)
MODIFIED=${ORIGINAL:0:-10}-1${ORIGINAL#${ORIGINAL:0:-10}}
mv $ORIGINAL $MODIFIED
- name: Upload Linux Installer
uses: actions/upload-artifact@v3
with:
name: sprout-ui-linux-installer
path: ${{ github.workspace }}/dist/*.deb
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- build_mac
- build_windows
- build_linux
steps:
- name: Setup AWS CLI
uses: chrislennon/action-aws-cli@v1.1
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Download Windows artifacts
uses: actions/download-artifact@v3
with:
name: sprout-ui-windows-installer
path: sprout-ui-windows-installer
- name: Download MacOS artifacts
uses: actions/download-artifact@v3
with:
name: sprout-ui-mac-installer
path: sprout-ui-mac-installer
- name: Download Linux artifacts
uses: actions/download-artifact@v3
with:
name: sprout-ui-linux-installer
path: sprout-ui-linux-installer
- name: Get Filenames
run: |
DMG_FILE=$(find ${{ github.workspace }}/sprout-ui-mac-installer/ -type f -name '*.dmg')
DEB_FILE=$(find ${{ github.workspace }}/sprout-ui-linux-installer/ -type f -name '*.deb')
EXE_FILE=$(find ${{ github.workspace }}/sprout-ui-windows-installer/ -type f -name '*.exe')
echo "DMG_FILE=$DMG_FILE" >>$GITHUB_ENV
echo "DEB_FILE=$DEB_FILE" >> $GITHUB_ENV
echo "EXE_FILE=$EXE_FILE" >> $GITHUB_ENV
- name: Release in Private Repo
uses: softprops/action-gh-release@v0.1.15
with:
files: |
${{ env.DMG_FILE }}
${{ env.DEB_FILE }}
${{ env.EXE_FILE }}
- name: Upload to S3
run: |
aws s3 cp "${{ env.DMG_FILE }}" s3://dlaas/releases/ --metadata md5="$(md5sum "${{ env.DMG_FILE }}" | cut -d ' ' -f 1)"
aws s3 cp "${{ env.DEB_FILE }}" s3://dlaas/releases/ --metadata md5="$(md5sum "${{ env.DEB_FILE }}" | cut -d ' ' -f 1)"
aws s3 cp "${{ env.EXE_FILE }}" s3://dlaas/releases/ --metadata md5="$(md5sum "${{ env.EXE_FILE }}" | cut -d ' ' -f 1)"
aws s3 cp "${{ env.DMG_FILE }}" s3://dlaas/releases/sprout-ui-mac-latest.dmg --metadata md5="$(md5sum "${{ env.DMG_FILE }}" | cut -d ' ' -f 1)"
aws s3 cp "${{ env.DEB_FILE }}" s3://dlaas/releases/sprout-ui-linux-latest.deb --metadata md5="$(md5sum "${{ env.DEB_FILE }}" | cut -d ' ' -f 1)"
aws s3 cp "${{ env.EXE_FILE }}" s3://dlaas/releases/sprout-ui-windows-latest.exe --metadata md5="$(md5sum "${{ env.EXE_FILE }}" | cut -d ' ' -f 1)"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'