Build & Bundle #309
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: | |
| workflow_dispatch: | |
| env: | |
| BINARY_NAME: plumeimpactor | |
| BINARY_NAME_CLI: plumesign | |
| BUNDLE_NAME: Impactor | |
| jobs: | |
| build-linux: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| arch: x86_64 | |
| - os: ubuntu-24.04-arm | |
| arch: aarch64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Use Wild linker | |
| uses: davidlattimore/wild-action@latest | |
| - uses: snok/install-poetry@v1 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Install and cache apt pkgs | |
| uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: flatpak flatpak-builder libglib2.0-dev libsecret-1-dev libgtk-3-dev libpng-dev libjpeg-dev libgl1-mesa-dev libglu1-mesa-dev libxkbcommon-dev libexpat1-dev libtiff-dev libxdo-dev libappindicator3-dev | |
| version: 1.0 | |
| - name: Build binaries | |
| run: | | |
| make linux PROFILE=release APPIMAGE=1 | |
| - name: Upload binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-linux-${{ matrix.arch }} | |
| path: dist/* | |
| build-windows: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-pc-windows-gnu | |
| - name: Install mingw-w64 | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y mingw-w64 | |
| - name: Build binaries (cross-compile) | |
| run: | | |
| cargo build --bins --workspace --release --target x86_64-pc-windows-gnu | |
| mkdir -p dist | |
| cp target/x86_64-pc-windows-gnu/release/plumeimpactor.exe dist/Impactor-windows-x86_64-portable.exe | |
| cp target/x86_64-pc-windows-gnu/release/plumesign.exe dist/plumesign-windows-x86_64.exe | |
| - name: Upload Bundles | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-windows | |
| path: dist/*.exe | |
| build-windows-installer: | |
| runs-on: windows-latest | |
| needs: [build-windows] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Windows Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-windows | |
| path: dist | |
| - name: Install NSIS | |
| run: choco install nsis.portable | |
| - name: Build NSIS Installer | |
| run: | | |
| mkdir dist\nsis | |
| copy package\windows\* dist\nsis\ | |
| copy dist\Impactor-windows-x86_64-portable.exe dist\nsis\plumeimpactor.exe | |
| makensis dist\nsis\installer.nsi | |
| move dist\nsis\installer.exe dist\Impactor-windows-x86_64-setup.exe | |
| - name: Upload Installer | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-windows-installer | |
| path: dist/Impactor-windows-x86_64-setup.exe | |
| build-macos-slices: | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - target: aarch64-apple-darwin | |
| arch: arm | |
| suffix: arm64 | |
| osxcross_prefix: arm64-apple-darwin21.4 | |
| - target: x86_64-apple-darwin | |
| arch: intel | |
| suffix: x86_64 | |
| osxcross_prefix: x86_64-apple-darwin21.4 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Setup osxcross | |
| uses: Timmmm/setup-osxcross@v3 | |
| with: | |
| osx-version: "12.3" | |
| - name: Build binaries (${{ matrix.arch }}) | |
| run: | | |
| target_env=$(echo "${{ matrix.target }}" | tr '-' '_') | |
| target_env_upper=$(echo "${target_env}" | tr '[:lower:]' '[:upper:]') | |
| prefix="${{ matrix.osxcross_prefix }}" | |
| osxcross_bin="$(dirname "$(command -v "${prefix}-clang")")" | |
| osxcross_root="$(cd "${osxcross_bin}/.." && pwd)" | |
| sdk_dir="${osxcross_root}/SDK" | |
| if [ -d "${sdk_dir}" ]; then | |
| sdkroot="$(ls -d "${sdk_dir}"/MacOSX*.sdk 2>/dev/null | sort -V | tail -n1)" | |
| if [ -n "${sdkroot}" ]; then | |
| export SDKROOT="${sdkroot}" | |
| fi | |
| fi | |
| export MACOSX_DEPLOYMENT_TARGET="11.0" | |
| ld_path="" | |
| for name in "${prefix}-ld" "${prefix}-ld64" "ld64" "ld"; do | |
| if [ -x "${osxcross_bin}/${name}" ]; then | |
| ld_path="${osxcross_bin}/${name}" | |
| break | |
| fi | |
| done | |
| export "CC_${target_env}=${osxcross_bin}/${prefix}-clang" | |
| export "CXX_${target_env}=${osxcross_bin}/${prefix}-clang++" | |
| export "AR_${target_env}=${osxcross_bin}/${prefix}-ar" | |
| export "RANLIB_${target_env}=${osxcross_bin}/${prefix}-ranlib" | |
| export "CARGO_TARGET_${target_env_upper}_LINKER=${osxcross_bin}/${prefix}-clang" | |
| if [ -n "${ld_path}" ]; then | |
| export "CFLAGS_${target_env}=-fuse-ld=${ld_path}" | |
| export "CXXFLAGS_${target_env}=-fuse-ld=${ld_path}" | |
| export "LDFLAGS_${target_env}=-fuse-ld=${ld_path}" | |
| export RUSTFLAGS="${RUSTFLAGS:+$RUSTFLAGS }-C link-arg=-fuse-ld=${ld_path}" | |
| fi | |
| cargo build --bins --workspace --release --target ${{ matrix.target }} | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/plumeimpactor dist/plumeimpactor-macos-${{ matrix.suffix }} | |
| cp target/${{ matrix.target }}/release/plumesign dist/plumesign-macos-${{ matrix.suffix }} | |
| - name: Upload ${{ matrix.arch }} Slice | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-macos-slice-${{ matrix.arch }} | |
| path: dist/* | |
| 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: dist/slices | |
| - name: Get Intel Slice | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-macos-slice-intel | |
| path: dist/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: | | |
| make macos BIN1=dist/slices/${{ env.BINARY_NAME }}-macos-arm64 BIN2=dist/slices/${{ env.BINARY_NAME }}-macos-x86_64 BUNDLE=1 ARCH=universal | |
| make macos BIN1=dist/slices/${{ env.BINARY_NAME_CLI }}-macos-arm64 BIN2=dist/slices/${{ env.BINARY_NAME_CLI }}-macos-x86_64 ARCH=universal | |
| - name: Codesign | |
| run: | | |
| mkdir -p dist/dmg | |
| mv dist/${{ env.BUNDLE_NAME }}.app dist/dmg/ | |
| codesign --deep --force --options runtime \ | |
| --sign "${{ secrets.DEV_ID_IDENTITY_NAME }}" dist/dmg/${{ env.BUNDLE_NAME }}.app | |
| - name: Create DMG | |
| run: | | |
| mkdir -p dist/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 \ | |
| dist/${{ env.BUNDLE_NAME }}-macos-universal.dmg dist/dmg | |
| - name: Notarize DMG | |
| run: | | |
| xcrun notarytool submit dist/${{ env.BUNDLE_NAME }}-macos-universal.dmg --apple-id "${{ secrets.APPLE_ID_EMAIL }}" --password "${{ secrets.APPLE_ID_PASSWORD }}" --team-id "${{ secrets.APPLE_ID_TEAM }}" --wait | |
| xcrun stapler staple dist/${{ env.BUNDLE_NAME }}-macos-universal.dmg | |
| - name: Upload Universal DMG | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BINARY_NAME }}-macos-universal | |
| path: | | |
| dist/${{ env.BUNDLE_NAME }}-macos-universal.dmg | |
| dist/${{ env.BINARY_NAME_CLI }}-macos-universal |