Release v0.3.0: update version and metainfo #27
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| build_aarch64_flatpak: | |
| description: 'Build aarch64 Flatpak (slow, ~6 hours with QEMU)' | |
| required: false | |
| default: false | |
| type: boolean | |
| build_armhf_flatpak: | |
| description: 'Build armhf Flatpak (slow, uses QEMU)' | |
| required: false | |
| default: false | |
| type: boolean | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # Build Linux binaries for multiple architectures | |
| build-binaries: | |
| name: Build Binary (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| arch: x86_64 | |
| use_cross: false | |
| - target: aarch64-unknown-linux-gnu | |
| arch: aarch64 | |
| use_cross: true | |
| - target: armv7-unknown-linux-gnueabihf | |
| arch: armhf | |
| use_cross: true | |
| - target: riscv64gc-unknown-linux-gnu | |
| arch: riscv64 | |
| use_cross: true | |
| - target: x86_64-unknown-linux-musl | |
| arch: x86_64-musl | |
| use_cross: true | |
| - target: aarch64-unknown-linux-musl | |
| arch: aarch64-musl | |
| use_cross: true | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.target }} | |
| - name: Install system dependencies (native build) | |
| if: ${{ !matrix.use_cross }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| pkg-config \ | |
| libgstreamer1.0-dev \ | |
| libgstreamer-plugins-base1.0-dev \ | |
| libgstreamer-plugins-bad1.0-dev \ | |
| libwayland-dev \ | |
| libxkbcommon-dev \ | |
| libinput-dev \ | |
| libudev-dev \ | |
| libseat-dev \ | |
| libclang-dev \ | |
| cmake \ | |
| nasm \ | |
| meson \ | |
| ninja-build \ | |
| python3-jinja2 \ | |
| python3-yaml \ | |
| python3-ply \ | |
| libyaml-dev | |
| - name: Build and install libcamera 0.7.0 (native build) | |
| if: ${{ !matrix.use_cross }} | |
| run: | | |
| git clone --depth 1 --branch v0.7.0 https://git.libcamera.org/libcamera/libcamera.git /tmp/libcamera | |
| cd /tmp/libcamera | |
| meson setup build -Dprefix=/usr -Dpipelines=uvcvideo,simple -Dipas=simple -Dgstreamer=disabled -Dtest=false -Dcam=disabled -Dqcam=disabled -Dlc-compliance=disabled -Dtracing=disabled -Ddocumentation=disabled -Dpycamera=disabled | |
| ninja -C build | |
| sudo ninja -C build install | |
| sudo ldconfig | |
| - name: Install cross | |
| if: ${{ matrix.use_cross }} | |
| run: cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Install podman | |
| if: ${{ matrix.use_cross }} | |
| run: sudo apt-get update && sudo apt-get install -y podman | |
| - name: Install just | |
| uses: extractions/setup-just@v3 | |
| - name: Build release binary | |
| env: | |
| CROSS_CONTAINER_ENGINE: podman | |
| run: | | |
| if [ "${{ matrix.use_cross }}" = "true" ]; then | |
| CROSS_BUILD_OPTS="--build-arg RUST_VERSION=$(rustc -V | cut -d' ' -f2)" \ | |
| cross build --release --target ${{ matrix.target }} | |
| else | |
| just build-release --target ${{ matrix.target }} | |
| fi | |
| - name: Package binary | |
| run: | | |
| mkdir -p dist | |
| cp target/${{ matrix.target }}/release/camera dist/ | |
| cd dist | |
| tar -czvf camera-${{ matrix.arch }}-linux.tar.gz camera | |
| rm camera | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: binary-${{ matrix.arch }} | |
| path: dist/camera-${{ matrix.arch }}-linux.tar.gz | |
| retention-days: 1 | |
| # Build Flatpak for x86_64 (native, fast) | |
| build-flatpak-x86_64: | |
| name: Build Flatpak (x86_64) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install Flatpak and flatpak-builder | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y flatpak flatpak-builder | |
| - name: Add Flathub remote | |
| run: sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| - name: Install just | |
| uses: extractions/setup-just@v3 | |
| - name: Install Flatpak dependencies | |
| run: just flatpak-deps x86_64 | |
| - name: Install Python dependencies | |
| run: pip install aiohttp toml tomlkit | |
| - name: Build Flatpak bundle | |
| run: just flatpak-bundle x86_64 | |
| - name: Upload Flatpak artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: flatpak-x86_64 | |
| path: camera-x86_64.flatpak | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # Build Flatpak for aarch64 (QEMU emulation, slow but necessary for releases) | |
| build-flatpak-aarch64: | |
| name: Build Flatpak (aarch64) | |
| runs-on: ubuntu-latest | |
| # Only run on manual trigger with build_aarch64_flatpak=true | |
| if: github.event_name == 'workflow_dispatch' && inputs.build_aarch64_flatpak | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install Flatpak and flatpak-builder | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y flatpak flatpak-builder | |
| - name: Set up QEMU for multi-arch builds | |
| uses: docker/setup-qemu-action@v4 | |
| with: | |
| platforms: arm64 | |
| - name: Add Flathub remote | |
| run: sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| - name: Install just | |
| uses: extractions/setup-just@v3 | |
| - name: Install Flatpak dependencies | |
| run: just flatpak-deps aarch64 | |
| - name: Install Python dependencies | |
| run: pip install aiohttp toml tomlkit | |
| - name: Build Flatpak bundle | |
| run: just flatpak-bundle aarch64 | |
| - name: Upload Flatpak artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: flatpak-aarch64 | |
| path: camera-aarch64.flatpak | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # Build Flatpak for armhf (QEMU emulation, slow) | |
| build-flatpak-armhf: | |
| name: Build Flatpak (armhf) | |
| runs-on: ubuntu-latest | |
| # Only run on manual trigger with build_armhf_flatpak=true | |
| if: github.event_name == 'workflow_dispatch' && inputs.build_armhf_flatpak | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install Flatpak and flatpak-builder | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y flatpak flatpak-builder | |
| - name: Set up QEMU for multi-arch builds | |
| uses: docker/setup-qemu-action@v4 | |
| with: | |
| platforms: arm | |
| - name: Add Flathub remote | |
| run: sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
| - name: Install just | |
| uses: extractions/setup-just@v3 | |
| - name: Install Flatpak dependencies | |
| run: just flatpak-deps arm | |
| - name: Install Python dependencies | |
| run: pip install aiohttp toml tomlkit | |
| - name: Build Flatpak bundle | |
| run: just flatpak-bundle arm | |
| - name: Upload Flatpak artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: flatpak-armhf | |
| path: camera-armhf.flatpak | |
| if-no-files-found: error | |
| retention-days: 1 | |
| # Create the GitHub release with all artifacts | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [build-binaries, build-flatpak-x86_64, build-flatpak-aarch64, build-flatpak-armhf] | |
| if: ${{ !cancelled() && needs.build-binaries.result == 'success' && needs.build-flatpak-x86_64.result == 'success' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: artifacts | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release-assets | |
| mv artifacts/binary-x86_64/camera-x86_64-linux.tar.gz release-assets/ | |
| mv artifacts/binary-aarch64/camera-aarch64-linux.tar.gz release-assets/ | |
| mv artifacts/binary-armhf/camera-armhf-linux.tar.gz release-assets/ | |
| mv artifacts/binary-riscv64/camera-riscv64-linux.tar.gz release-assets/ | |
| mv artifacts/binary-x86_64-musl/camera-x86_64-musl-linux.tar.gz release-assets/ | |
| mv artifacts/binary-aarch64-musl/camera-aarch64-musl-linux.tar.gz release-assets/ | |
| mv artifacts/flatpak-x86_64/camera-x86_64.flatpak release-assets/ | |
| # aarch64 flatpak is optional (only built when manually triggered) | |
| if [ -d "artifacts/flatpak-aarch64" ]; then | |
| mv artifacts/flatpak-aarch64/camera-aarch64.flatpak release-assets/ | |
| fi | |
| # armhf flatpak is optional (only built when manually triggered) | |
| if [ -d "artifacts/flatpak-armhf" ]; then | |
| mv artifacts/flatpak-armhf/camera-armhf.flatpak release-assets/ | |
| fi | |
| git archive --format=zip --prefix=camera-${{ github.ref_name }}/ -o release-assets/camera-${{ github.ref_name }}-source.zip HEAD | |
| - name: Generate release notes | |
| run: | | |
| cat << 'EOF' > release_notes_footer.md | |
| ## Installation | |
| ### Flatpak (Recommended) | |
| ```bash | |
| flatpak install camera-x86_64.flatpak | |
| ``` | |
| ### Binary | |
| ```bash | |
| tar -xzf camera-x86_64-linux.tar.gz | |
| ./camera | |
| ``` | |
| ## Assets | |
| | File | Description | | |
| |------|-------------| | |
| | `camera-x86_64.flatpak` | Flatpak bundle for x86_64 | | |
| | `camera-x86_64-linux.tar.gz` | Linux binary for x86_64 | | |
| | `camera-aarch64-linux.tar.gz` | Linux binary for ARM64 | | |
| | `camera-armhf-linux.tar.gz` | Linux binary for armhf (32-bit) | | |
| | `camera-riscv64-linux.tar.gz` | Linux binary for RISC-V 64 | | |
| | `camera-x86_64-musl-linux.tar.gz` | Linux binary for x86_64 (musl/static) | | |
| | `camera-aarch64-musl-linux.tar.gz` | Linux binary for ARM64 (musl/static) | | |
| | `camera-${{ github.ref_name }}-source.zip` | Source code | | |
| EOF | |
| # Add aarch64 flatpak to release notes if it was built | |
| if [ -f "release-assets/camera-aarch64.flatpak" ]; then | |
| sed -i '/camera-x86_64.flatpak/a | `camera-aarch64.flatpak` | Flatpak bundle for ARM64 |' release_notes_footer.md | |
| fi | |
| # Add armhf flatpak to release notes if it was built | |
| if [ -f "release-assets/camera-armhf.flatpak" ]; then | |
| sed -i '/camera-x86_64.flatpak/a | `camera-armhf.flatpak` | Flatpak bundle for armhf (32-bit) |' release_notes_footer.md | |
| fi | |
| - name: Create GitHub Release | |
| run: | | |
| gh api repos/${{ github.repository }}/releases/generate-notes \ | |
| -f tag_name="${{ github.ref_name }}" \ | |
| --jq '.body' > release_notes.md | |
| cat release_notes_footer.md >> release_notes.md | |
| gh release create ${{ github.ref_name }} \ | |
| --title "Camera ${{ github.ref_name }}" \ | |
| --notes-file release_notes.md \ | |
| release-assets/* | |
| env: | |
| GH_TOKEN: ${{ github.token }} |