Build & Bundle #73
Workflow file for this run
This file contains hidden or 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: "Build & Bundle" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'crates/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - 'apps/**' | |
| - 'package/**' | |
| - '.github/workflows/build.yml' | |
| workflow_dispatch: | |
| env: | |
| BINARY_NAME: plumeimpactor | |
| BUNDLE_NAME: Impactor | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: linux-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: linux-cargo- | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libgtk-3-dev libpng-dev libjpeg-dev libgl1-mesa-dev libglu1-mesa-dev libxkbcommon-dev libexpat1-dev libtiff-dev | |
| - name: Build Dependencies | |
| run: | | |
| cargo install patch-crate | |
| cargo fetch --locked || true | |
| cargo patch-crate --force | |
| cargo install cargo-bundle | |
| mkdir -p build/out | |
| - name: Build & Bundle (Linux) | |
| run: | | |
| cargo bundle --bin ${{ env.BINARY_NAME }} --package ${{ env.BINARY_NAME }} --release --format appimage | |
| cp -R target/release/bundle/appimage/*.AppImage build/out/ | |
| - name: Upload Bundles | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-linux | |
| path: build/out/* | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Setup Windows MSVC environment | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - name: Build Dependencies | |
| run: | | |
| cargo install patch-crate | |
| cargo fetch --locked || true | |
| cargo patch-crate --force | |
| mkdir -p build/out | |
| mkdir -p build/nsis | |
| - name: Build & Bundle (Windows) | |
| run: | | |
| cargo build --bin ${{ env.BINARY_NAME }} --release | |
| cp target/release/${{ env.BINARY_NAME }}.exe build/nsis | |
| - name: Create NSIS Installer | |
| run: | | |
| mv package/windows/* build/nsis/ | |
| choco install nsis.portable | |
| makensis build/nsis/installer.nsi | |
| mv build/nsis/PlumeInstaller.exe build/out/${{ env.BINARY_NAME }}-setup.exe | |
| - name: Upload Bundles | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-windows | |
| path: build/out/* | |
| build-macos-slices: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| arch: arm | |
| - os: macos-15-intel | |
| target: x86_64-apple-darwin | |
| arch: intel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build Dependencies | |
| run: | | |
| cargo install patch-crate | |
| cargo fetch --locked || true | |
| cargo patch-crate --force | |
| mkdir -p build/out | |
| - name: Build (macOS ${{ matrix.arch }}) | |
| run: | | |
| cargo build --bin ${{ env.BINARY_NAME }} --release --target ${{ matrix.target }} | |
| strip target/${{ matrix.target }}/release/${{ env.BINARY_NAME }} | |
| cp target/${{ matrix.target }}/release/${{ env.BINARY_NAME }} build/out/${{ env.BINARY_NAME }}-${{ matrix.arch }} | |
| - name: Upload ${{ matrix.arch }} Slice | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-macos-slice-${{ matrix.arch }} | |
| path: build/out/${{ env.BINARY_NAME }}-${{ matrix.arch }} | |
| build-macos-universal: | |
| runs-on: macos-latest | |
| needs: [build-macos-slices] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get ARM Slice | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-macos-slice-arm | |
| path: build/slices | |
| - name: Get Intel Slice | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-macos-slice-intel | |
| path: build/slices | |
| - name: Setup Certificates | |
| uses: apple-actions/import-codesign-certs@v5 | |
| with: | |
| p12-file-base64: ${{ secrets.DEV_ID_P12_BASE64 }} | |
| p12-password: ${{ secrets.DEV_ID_P12_PASSWORD }} | |
| - name: Download CreateDMG | |
| run: | | |
| brew install create-dmg | |
| - name: Create Universal Binary | |
| run: | | |
| mkdir -p build/universal | |
| lipo -create -output build/universal/${{ env.BINARY_NAME }} build/slices/${{ env.BINARY_NAME }}-arm build/slices/${{ env.BINARY_NAME }}-intel | |
| chmod +x build/universal/${{ env.BINARY_NAME }} | |
| # for udid | |
| gmake | |
| - name: Bundle | |
| run: | | |
| mkdir -p build/dmg | |
| cp -R package/macos/${{ env.BUNDLE_NAME }}.app build/dmg/${{ env.BUNDLE_NAME }}.app | |
| mkdir -p build/dmg/${{ env.BUNDLE_NAME }}.app/Contents/MacOS | |
| mv build/universal/${{ env.BINARY_NAME }} build/dmg/${{ env.BUNDLE_NAME }}.app/Contents/MacOS/${{ env.BINARY_NAME }} | |
| # for udid | |
| mv build/udid build/dmg/${{ env.BUNDLE_NAME }}.app/Contents/MacOS/udid | |
| - name: Codesign | |
| run: | | |
| codesign --deep --force --options runtime \ | |
| --sign "${{ secrets.DEV_ID_IDENTITY_NAME }}" build/dmg/${{ env.BUNDLE_NAME }}.app | |
| - name: Create DMG | |
| run: | | |
| mkdir -p build/out | |
| create-dmg \ | |
| --volname ${{ env.BUNDLE_NAME }} \ | |
| --background "package/macos/background.png" \ | |
| --window-pos 200 120 \ | |
| --window-size 510 350 \ | |
| --icon-size 100 \ | |
| --icon ${{ env.BUNDLE_NAME }}.app 160 155 \ | |
| --hide-extension "${{ env.BUNDLE_NAME }}.app" \ | |
| --app-drop-link 350 155 \ | |
| build/out/${{ env.BUNDLE_NAME }}.dmg build/dmg | |
| - name: Notarize DMG | |
| run: | | |
| xcrun notarytool submit build/out/${{ env.BUNDLE_NAME }}.dmg --apple-id "${{ secrets.APPLE_ID_EMAIL }}" --password "${{ secrets.APPLE_ID_PASSWORD }}" --team-id "${{ secrets.APPLE_ID_TEAM }}" --wait | |
| xcrun stapler staple build/out/${{ env.BUNDLE_NAME }}.dmg | |
| - name: Upload Universal DMG | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-macos-universal | |
| path: build/out/${{ env.BUNDLE_NAME }}.dmg |