build: fix .app path #15
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 and Package | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| bin_path: target/x86_64-unknown-linux-gnu/release | |
| asset_name: -linux-x86_64 | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| bin_path: target/x86_64-pc-windows-msvc/release | |
| asset_name: -windows-x86_64.exe | |
| extension: .exe | |
| - os: macos-latest | |
| target: aarch64-apple-darwin | |
| bin_path: target/aarch64-apple-darwin/release | |
| asset_name: -macos-arm64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| submodules: 'true' | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install system dependencies | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libasound2-dev \ | |
| libfontconfig-dev \ | |
| libwayland-dev \ | |
| libx11-xcb-dev \ | |
| libxkbcommon-x11-dev \ | |
| libxkbcommon-dev \ | |
| libxcb1-dev \ | |
| libssl-dev \ | |
| libzstd-dev \ | |
| libvulkan1 \ | |
| libgit2-dev \ | |
| libsqlite3-dev | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| - name: Build binary | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| run: | | |
| cargo build --release --target ${{ matrix.target }} | |
| - name: Package binary | |
| run: | | |
| mkdir -p dist | |
| cp "${{ matrix.bin_path }}/broquest${{ matrix.extension || '' }}" "dist/broquest${{ matrix.asset_name }}" | |
| - name: Package .app bundle | |
| if: runner.os == 'macOS' | |
| run: | | |
| APP_NAME="Broquest" | |
| APP_IDENTIFIER="se.zanmato.broquest" | |
| APP_VERSION="${GITHUB_REF#refs/tags/v}" | |
| YEAR="$(date +%Y)" | |
| APP_PATH="${APP_NAME}.app" | |
| BINARY="dist/broquest${{ matrix.asset_name }}" | |
| # Create .app bundle structure | |
| mkdir -p "${APP_PATH}/Contents/MacOS" | |
| mkdir -p "${APP_PATH}/Contents/Resources" | |
| # Copy binary | |
| cp "${BINARY}" "${APP_PATH}/Contents/MacOS/${APP_NAME}" | |
| chmod +x "${APP_PATH}/Contents/MacOS/${APP_NAME}" | |
| # Copy icon | |
| cp crates/broquest/resources/AppIcon.icns "${APP_PATH}/Contents/Resources/" || true | |
| # Create and substitute Info.plist variables | |
| sed -e "s|{{APP_NAME}}|${APP_NAME}|g" \ | |
| -e "s|{{APP_IDENTIFIER}}|${APP_IDENTIFIER}|g" \ | |
| -e "s|{{APP_VERSION}}|${APP_VERSION}|g" \ | |
| -e "s|{{YEAR}}|${YEAR}|g" \ | |
| crates/broquest/resources/Info.plist > "${APP_PATH}/Contents/Info.plist" | |
| # Create .tar.gz archive | |
| tar -czf "dist/broquest${{ matrix.asset_name }}.tar.gz" "${APP_NAME}.app" | |
| rm "dist/broquest${{ matrix.asset_name }}" | |
| - name: Package .deb | |
| if: runner.os == 'Linux' | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| run: | | |
| ./script/package-deb | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: broquest-${{ matrix.target }} | |
| path: | | |
| dist/broquest* | |
| - name: Upload .deb artifact | |
| if: runner.os == 'Linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: broquest-deb | |
| path: build/broquest_*.deb | |
| release: | |
| name: Upload Release Assets | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| artifacts/broquest-*/broquest* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |