285 lines
10 KiB
YAML
285 lines
10 KiB
YAML
name: build-publish-apps
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
release:
|
|
types: [published]
|
|
schedule:
|
|
- cron: '0 4 * * *'
|
|
# Daily at 04:00 AM UTC
|
|
# Will checkout the last commit from the default branch (main as of 2023-10-04)
|
|
|
|
env:
|
|
CUT_RELEASE_PR: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }}
|
|
BUILD_RELEASE: true
|
|
BUCKET_NAME: 'dl.kittycad.io'
|
|
BUCKET_FOLDER: 'releases/modeling-app/test/electron'
|
|
WEBSITE_DIR: 'dl.zoo.dev/releases/modeling-app/test/electron'
|
|
GOOGLE_CLOUD_PROJECT_ID: 'kittycadapi'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
prepare-files:
|
|
runs-on: ubuntu-22.04 # seperate job on Ubuntu for easy string manipulations (compared to Windows)
|
|
outputs:
|
|
version: ${{ steps.export_version.outputs.version }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'yarn'
|
|
|
|
- run: yarn install
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: './src/wasm-lib'
|
|
|
|
# TODO: see if we can fetch from main instead if no diff at src/wasm-lib
|
|
- name: Run build:wasm
|
|
run: "yarn build:wasm${{ env.BUILD_RELEASE == 'true' && '-dev' || ''}}"
|
|
|
|
- name: Set nightly version
|
|
if: github.event_name == 'schedule'
|
|
run: |
|
|
VERSION=$(date +'%-y.%-m.%-d') yarn bump-jsons
|
|
|
|
# TODO: see if we need to inject updater nightly URL here https://dl.zoo.dev/releases/modeling-app/nightly/last_update.json
|
|
# TODO: see if we ned to add updater test URL here https://dl.zoo.dev/releases/modeling-app/updater-test/last_update.json
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: prepared-files
|
|
path: |
|
|
package.json
|
|
src/wasm-lib/pkg/wasm_lib*
|
|
|
|
- id: export_version
|
|
run: echo "version=`cat package.json | jq -r '.version'`" >> "$GITHUB_OUTPUT"
|
|
|
|
|
|
build-apps:
|
|
needs: [prepare-files]
|
|
strategy:
|
|
matrix:
|
|
os: [macos-14, windows-2022, ubuntu-22.04]
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
|
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
|
WINDOWS_CERTIFICATE_THUMBPRINT: F4C9A52FF7BC26EE5E054946F6B11DEEA94C748D
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/download-artifact@v3
|
|
name: prepared-files
|
|
|
|
- name: Copy prepared files
|
|
run: |
|
|
ls -R prepared-files
|
|
cp prepared-files/package.json package.json
|
|
cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public
|
|
mkdir src/wasm-lib/pkg
|
|
cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg
|
|
|
|
- name: Sync node version and setup cache
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
|
|
|
- run: yarn install
|
|
|
|
- name: Add macOS signing certificate
|
|
if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'macos-14' }}
|
|
run: chmod +x add-osx-cert.sh && ./add-osx-cert.sh
|
|
|
|
- name: Prepare certificate and variables (Windows only)
|
|
if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }}
|
|
run: |
|
|
echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
|
|
cat /d/Certificate_pkcs12.p12
|
|
echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
|
|
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
|
|
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
|
|
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
|
|
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
|
|
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
|
|
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
|
|
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH
|
|
shell: bash
|
|
|
|
- name: Setup certicate with SSM KSP (Windows only)
|
|
if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }}
|
|
run: |
|
|
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi
|
|
msiexec /i smtools-windows-x64.msi /quiet /qn
|
|
smksp_registrar.exe list
|
|
smctl.exe keypair ls
|
|
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
|
|
smksp_cert_sync.exe
|
|
shell: cmd
|
|
|
|
- name: Make the app for arm64
|
|
if: ${{ env.BUILD_RELEASE == 'false' }}
|
|
run: "yarn electron-forge make --arch arm64"
|
|
|
|
- name: Publish the app for arm64 (dry run)
|
|
if: ${{ env.BUILD_RELEASE == 'true' }}
|
|
run: "yarn electron-forge publish --arch arm64 --dry-run"
|
|
|
|
- name: Sign Windows arm64 builds using Signtool
|
|
if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }}
|
|
env:
|
|
FILE: "D:\\a\\modeling-app\\modeling-app\\out\\make\\squirrel.windows\\arm64\\Zoo Modeling App-*Setup.exe"
|
|
run: |
|
|
signtool.exe sign /sha1 ${{ env.WINDOWS_CERTIFICATE_THUMBPRINT }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 "${{ env.FILE }}"
|
|
signtool.exe verify /v /pa "${{ env.FILE }}"
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: out-${{ matrix.os }}-arm64
|
|
path: |
|
|
out/make/**/arm64/*
|
|
out/make/*.dmg
|
|
out/publish-dry-run/*/*
|
|
|
|
- name: Make the app for x64
|
|
if: ${{ env.BUILD_RELEASE == 'false' }}
|
|
run: "yarn electron-forge make --arch x64"
|
|
|
|
- name: Publish the app for x64 (dry run)
|
|
if: ${{ env.BUILD_RELEASE == 'true' }}
|
|
run: "yarn electron-forge publish --arch x64 --dry-run"
|
|
|
|
- name: Sign Windows x64 builds using Signtool
|
|
if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }}
|
|
env:
|
|
FILE: "D:\\a\\modeling-app\\modeling-app\\out\\make\\squirrel.windows\\x64\\Zoo Modeling App-*Setup.exe"
|
|
run: |
|
|
signtool.exe sign /sha1 ${{ env.WINDOWS_CERTIFICATE_THUMBPRINT }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 "${{ env.FILE }}"
|
|
signtool.exe verify /v /pa "${{ env.FILE }}"
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: out-${{ matrix.os }}-x64
|
|
path: |
|
|
out/make/**/x64/*
|
|
out/make/*.dmg
|
|
out/publish-dry-run/*/*
|
|
|
|
# TODO: add the 'Build for Mac TestFlight (nightly)' stage back
|
|
|
|
|
|
publish-apps-release:
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: write
|
|
if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }}
|
|
needs: [prepare-files, build-apps]
|
|
# env:
|
|
# VERSION_NO_V: ${{ needs.prepare-json-files.outputs.version }}
|
|
# VERSION: ${{ github.event_name == 'release' && format('v{0}', needs.prepare-json-files.outputs.version) || needs.prepare-json-files.outputs.version }}
|
|
# PUB_DATE: ${{ github.event_name == 'release' && github.event.release.created_at || github.event.repository.updated_at }}
|
|
# NOTES: ${{ github.event_name == 'release' && github.event.release.body || format('Nightly build, commit {0}', github.sha) }}
|
|
# BUCKET_DIR: ${{ github.event_name == 'release' && 'dl.kittycad.io/releases/modeling-app' || 'dl.kittycad.io/releases/modeling-app/nightly' }}
|
|
# WEBSITE_DIR: ${{ github.event_name == 'release' && 'dl.zoo.dev/releases/modeling-app' || 'dl.zoo.dev/releases/modeling-app/nightly' }}
|
|
# URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: out-windows-2022-arm64
|
|
path: out
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: out-windows-2022-x64
|
|
path: out
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: out-macos-14-arm64
|
|
path: out
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: out-macos-14-x64
|
|
path: out
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: out-ubuntu-22.04-arm64
|
|
path: out
|
|
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: out-ubuntu-22.04-x64
|
|
path: out
|
|
|
|
- name: List artifacts
|
|
run: "ls -R out"
|
|
|
|
- name: Authenticate to Google Cloud
|
|
uses: 'google-github-actions/auth@v2.1.5'
|
|
with:
|
|
credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}'
|
|
|
|
- name: Set up Google Cloud SDK
|
|
uses: google-github-actions/setup-gcloud@v2.1.0
|
|
with:
|
|
project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }}
|
|
|
|
- name: Sync node version and setup cache
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'yarn' # Set this to npm, yarn or pnpm.
|
|
|
|
- run: yarn install
|
|
|
|
- run: yarn electron-forge publish --from-dry-run
|
|
|
|
# TODO: Add GitHub publisher
|
|
|
|
announce_release:
|
|
needs: [publish-apps-release]
|
|
runs-on: ubuntu-22.04
|
|
if: github.event_name == 'release'
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install requests
|
|
|
|
- name: Announce Release
|
|
env:
|
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
RELEASE_VERSION: ${{ github.event.release.tag_name }}
|
|
RELEASE_BODY: ${{ github.event.release.body}}
|
|
run: python public/announce_release.py
|