Icestudio OSX ARM64 #445
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
name: 'Icestudio OSX ARM64' | |
# Controls when the action will run. | |
on: | |
# Workflow run automatically when prettier hook finish succesfully | |
workflow_run: | |
workflows: ['Code standardizer hook for PRs'] | |
types: | |
- completed | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# Only runs if standardizer runs OK | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
# The type of runner that the job will run on | |
#runs-on: macos-10.15 | |
runs-on: macOS-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Check commit message for keyword RUN_BUILD | |
- name: Check commit message for RUN_BUILD | |
id: commit_message_check | |
run: | | |
COMMIT_MESSAGE=$(git log -1 --pretty=%B) | |
echo "Commit message: $COMMIT_MESSAGE" | |
if [[ "$COMMIT_MESSAGE" != *"RUN_BUILD"* ]]; then | |
echo "Commit message does not contain RUN_BUILD, skipping build." | |
echo "skip_build=true" >> $GITHUB_ENV | |
fi | |
- name: 🔍 Replace NW SDK version for normal before install npm packages | |
run: | | |
sed -i '' 's/\("nw": "[^"]*\)-sdk"/\1"/g' package.json | |
- name: Setup Nodejs version | |
if: env.skip_build != 'true' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '23.3.0' | |
- name: Install npm dependencies | |
if: env.skip_build != 'true' | |
run: | | |
sed -i '' 's/darwinDependencies/dependencies/g' package.json | |
npm install --legacy-peer-deps | |
- name: Build OSX ARM64 packages | |
if: env.skip_build != 'true' | |
env: | |
MACOS_CERTIFICATE: ${{ secrets.APPLE_CERT_DATA }} | |
MACOS_CERTIFICATE_PWD: ${{ secrets.APPLE_CERT_PASSWORD }} | |
CODESIGN_ID: ${{ secrets.APPLE_TEAM_ID }} | |
MACOS_KEYCHAIN_PASS: ${{ secrets.LOCAL_KEYCHAIN_PASS }} | |
run: | | |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 | |
security create-keychain -p $MACOS_KEYCHAIN_PASS build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p $MACOS_KEYCHAIN_PASS build.keychain | |
security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PASS build.keychain | |
npm run buildOSXARM64 | |
ls dist/ | |
# Loading vars from icestudio package.json | |
- id: icestudio_json | |
if: env.skip_build != 'true' | |
run: | | |
content=`tr '\n' ' ' < package.json` | |
echo "packageJson=${content}" >> $GITHUB_OUTPUT | |
# Timestamp for the build | |
- id: build_date | |
if: env.skip_build != 'true' | |
run: | | |
content=`tr '\n' ' ' < app/buildinfo.json` | |
echo "buildJson=${content}" >> $GITHUB_OUTPUT | |
- name: Sign DMG | |
if: env.skip_build != 'true' | |
env: | |
ICESTUDIO_VERSION: '${{fromJson(steps.icestudio_json.outputs.packageJson).version}}' | |
TIMESTAMP: '${{fromJson(steps.build_date.outputs.buildJson).ts}}' | |
MACOS_APPLE_UID: ${{ secrets.APPLE_TEAM_ID }} | |
run: | | |
codesign --force --deep --sign ${MACOS_APPLE_UID} dist/icestudio-${ICESTUDIO_VERSION}${TIMESTAMP}-osxarm64.dmg -v | |
- name: 'Upload DMG/OSX64' | |
if: env.skip_build != 'true' | |
env: | |
ICESTUDIO_VERSION: '${{fromJson(steps.icestudio_json.outputs.packageJson).version}}' | |
TIMESTAMP: '${{fromJson(steps.build_date.outputs.buildJson).ts}}' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: 'osxarm64_DMG_${{env.ICESTUDIO_VERSION}}${{env.TIMESTAMP}}' | |
path: 'dist/icestudio-${{env.ICESTUDIO_VERSION}}${{env.TIMESTAMP}}-osxarm64.dmg' | |
if-no-files-found: error |