diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 32695b58..bcb43a3d 100644 --- 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 index 5a63d5ba..6b00aa34 100755 --- 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."