commit 79e02287903ac0a9a84f89fc58a8815865b29f57
parent 921c0f1118e5ccea0a9f9d79ced92b99f05077ea
Author: William Casarin <jb55@jb55.com>
Date: Wed, 27 Nov 2024 14:52:32 -0800
github: automatically build and sign macOS dmg
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
@@ -42,7 +42,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [ubuntu-latest, windows-latest]
+ os: [ubuntu-latest, windows-latest, macos-latest]
toolchain: [stable]
steps:
# Checkout the repository
@@ -96,6 +96,14 @@ jobs:
name: notedeck-linux-bin
path: target/release/notedeck
+ # Upload artifacts (for macOS, adjust paths as needed)
+ - name: Upload Build Artifacts (macOS)
+ if: runner.os == 'macOS'
+ uses: actions/upload-artifact@v4
+ with:
+ name: notedeck-macos-bin
+ path: target/release/notedeck
+
# Upload exe for further packaging steps
- name: Upload Build Artifacts (Windows)
if: runner.os == 'Windows'
@@ -150,6 +158,54 @@ jobs:
name: notedeck.deb
path: target/debian/*.deb
+ macos-dmg:
+ name: Build macOS DMG
+ runs-on: macos-latest
+ needs: build-and-test
+ env:
+ NOTEDECK_APPLE_RELEASE_CERT_ID: ${{ secrets.NOTEDECK_APPLE_RELEASE_CERT_ID }}
+ NOTEDECK_RELEASE_APPLE_ID: ${{ secrets.NOTEDECK_RELEASE_APPLE_ID }}
+ NOTEDECK_APPLE_APP_SPECIFIC_PW: ${{ secrets.NOTEDECK_APPLE_APP_SPECIFIC_PW }}
+ NOTEDECK_APPLE_TEAM_ID: ${{ secrets.NOTEDECK_APPLE_TEAM_ID }}
+ steps:
+ # Checkout the repository
+ - name: Checkout Code
+ uses: actions/checkout@v2
+
+ # Set up Rust
+ - name: Setup Rust
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
+
+ - name: Download Build Artifacts (MacOS)
+ uses: actions/download-artifact@v4
+ with:
+ name: notedeck-macos-bin # Assuming you need the Release build
+ path: target/release
+
+ - name: Install Required Tools
+ run: |
+ brew install create-dmg
+ cargo install cargo-bundle
+
+ - name: Import apple codesign cert
+ uses: apple-actions/import-codesign-certs@v3
+ with:
+ p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
+ p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
+
+ - name: Run macOS DMG Build Script
+ run: ./scripts/macos_build.sh
+
+ - name: Upload DMG Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: notedeck.dmg
+ path: packages/notedeck.dmg
+
windows-installer:
name: Build Windows Installer
runs-on: windows-latest
diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh
@@ -75,11 +75,11 @@ rm notedeck.zip
# Create the .dmg package
echo "Creating .dmg package..."
-mkdir -p dist
+mkdir -p packages
create-dmg \
--window-size 600 400 \
--app-drop-link 400 100 \
- dist/notedeck.dmg \
+ packages/notedeck.dmg \
target/release/bundle/osx/notedeck.app
echo "Build and signing process completed successfully."