Skip to content

SUB - Build on macOS #46

SUB - Build on macOS

SUB - Build on macOS #46

name: SUB - Build on macOS
on:
workflow_dispatch:
inputs:
env:
description: "An Environment"
required: true
type: choice
options:
- Development
- Production
version:
description: "A Version"
required: true
type: string
caching:
description: "Use caching"
required: true
type: boolean
default: false
workflow_call:
inputs:
env:
description: "An Environment"
required: true
type: string
version:
description: "A Version"
required: true
type: string
caching:
description: "Use caching"
required: true
type: boolean
default: false
env:
app_name: ${{ inputs.env == 'Production' && 'SuperHumanInstaller' || 'SuperHumanInstallerDev' }}
app_id: net.prominic.genesis.${{ inputs.env == 'Production' && 'superhumaninstaller' || 'superhumaninstallerdev' }}
haxe_flag: ${{ inputs.env == 'Production' && '-final' || '-debug -Dverbose_logs -Ddebug_logs' }}
haxe_version: 4.3.6
bin_path: Export/${{ inputs.env }}/macos/bin/
jobs:
build:
runs-on: macos-13
steps:
- name: Build info
run: |
echo "Ref: ${{ github.ref_name }}"
echo "Env: ${{ inputs.env }}"
echo "Version: ${{ inputs.version }}"
echo "App Name: ${{ env.app_name }}"
echo "App ID: ${{ env.app_id }}"
echo "Haxe Env Flag: ${{ env.haxe_flag }}"
- name: Checkout repo
uses: actions/checkout@v4
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Override project.xml version
uses: Moonshine-IDE/[email protected]
with:
filepath: "project.xml"
xpath: "/project/meta/@version"
replace: "${{ inputs.version }}"
- name: Set up Haxe
uses: Moonshine-IDE/setup-haxe-action@master
with:
haxe-version: ${{ env.haxe_version }}
- name: Show haxe info
run: |
echo "Haxe version:"
haxe -version
echo "Haxe lib path:"
haxelib config
- name: Update haxelib
run: haxelib --global update haxelib
- name: Cache Binaries
id: cache-bin
if: ${{ inputs.caching }}
uses: actions/cache@v4
with:
path: ${{ env.bin_path }}
key: ${{ env.app_name }}-macos-bin
- name: Install dependencies
if: ${{ !inputs.caching || !steps.cache-bin.outputs.cache-hit }}
working-directory: Build
run: |
haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp.git v4.3.68
pushd .
cd /Users/runner/hostedtoolcache/haxe/${{env.haxe_version}}/x64/lib/hxcpp/git/tools/hxcpp
haxe compile.hxml
popd
haxelib install lime 8.2.1
haxelib install format
haxelib install hxp
haxelib install yaml
haxelib git lime-samples https://github.com/openfl/lime-samples
haxelib install openfl 9.4.0
haxelib run openfl setup
haxelib git feathersui https://github.com/feathersui/feathersui-openfl.git
haxelib git champaign https://github.com/Moonshine-IDE/Champaign.git
haxelib git mxhx-component https://github.com/mxhx-dev/mxhx-component.git
haxelib git mxhx-feathersui https://github.com/mxhx-dev/mxhx-feathersui.git
- name: Build
if: ${{ !inputs.caching || !steps.cache-bin.outputs.cache-hit }}
run: >
haxelib run openfl build project.xml mac
${{ env.haxe_flag }}
-Dlogverbose
-Dlogcolor
-Dgitsha=${{ github.sha }}
-Dgitbranch=${{ github.ref_name }}
- name: Show Build
run: ls -r ${{ env.bin_path }}
- name: Upload bin
uses: actions/upload-artifact@v4
with:
name: ${{ env.app_name }}-macos-bin
path: ${{ env.bin_path }}
- name: Sign app
uses: Moonshine-IDE/macos-sign-app-action@main
with:
app-path: ${{ env.bin_path }}/${{ env.app_name }}.app
mac-keychain-pass: ${{ secrets.MAC_KEYCHAIN_PASS }}
mac-application-certkey: ${{ secrets.MAC_APPLICATION_CERTKEY }}
mac-certkey-pass: ${{ secrets.MAC_CERTKEY_PASS }}
- name: Create installer
run: |
productbuild \
--version ${{ inputs.version }} \
--product Templates/installer/SuperHumanInstaller.template.plist \
--identifier ${{ env.app_id }} \
--component ${{ env.bin_path }}/${{ env.app_name }}.app \
/Applications \
./${{ env.app_name }}-Setup-Unsigned.pkg
- name: Sign installer
uses: Moonshine-IDE/[email protected]
with:
unsigned-pkg-path: ./${{ env.app_name }}-Setup-Unsigned.pkg
signed-pkg-path: ./${{ env.app_name }}-Setup.pkg
mac-keychain-pass: ${{ secrets.MAC_KEYCHAIN_PASS }}
mac-installer-certkey: ${{ secrets.MAC_INSTALLER_CERTKEY }}
mac-certkey-pass: ${{ secrets.MAC_CERTKEY_PASS }}
- name: Notarize installer
uses: Moonshine-ide/[email protected]
with:
app-path: ./${{ env.app_name }}-Setup.pkg
mac-notarization-apple-id: ${{ secrets.MAC_NOTARIZATION_APPLE_ID }}
mac-notarization-team-id: ${{ secrets.MAC_NOTARIZATION_TEAM_ID }}
mac-notarization-pass: ${{ secrets.MAC_NOTARIZATION_PASS }}
- name: Upload Installer
uses: actions/upload-artifact@v4
with:
name: ${{ env.app_name }}-macos-installer
path: ./${{ env.app_name }}-Setup.pkg
if-no-files-found: error