name: Release permissions: contents: write packages: write on: release: types: [created] workflow_dispatch: inputs: tag: description: "Tag to attach assets to (e.g. v1.0.0)" required: false jobs: prepare: runs-on: ubuntu-latest outputs: tag: ${{ steps.tag.outputs.tag }} steps: - name: Determine tag to use id: tag run: | set -euo pipefail INPUT_TAG="${{ github.event.inputs.tag || '' }}" EVENT_TAG="${{ github.event.release.tag_name || '' }}" if [ -n "$INPUT_TAG" ]; then echo "tag=$INPUT_TAG" >> $GITHUB_OUTPUT elif [ -n "$EVENT_TAG" ]; then echo "tag=$EVENT_TAG" >> $GITHUB_OUTPUT elif [[ "${GITHUB_REF:-}" =~ ^refs/tags/(.+)$ ]]; then echo "tag=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT else LATEST_JSON=$(curl -sSf -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/${{ github.repository }}/releases/latest" || true) TAG_NAME=$(echo "$LATEST_JSON" | jq -r '.tag_name // empty') if [ -n "$TAG_NAME" ]; then echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT else echo "tag=" >> $GITHUB_OUTPUT fi fi - name: Fail if no tag determined if: ${{ steps.tag.outputs.tag == '' }} run: | echo "ERROR: No tag determined." exit 1 build-release: needs: prepare strategy: matrix: include: - arch: x64 runner: ubuntu-latest - arch: arm64 runner: ubuntu-24.04-arm fail-fast: false runs-on: ${{ matrix.runner }} steps: - name: Install apt deps run: | sudo apt-get update sudo apt-get install -y \ zip jq \ libpipewire-0.3-dev \ libclang-dev \ libasound2-dev \ libdbus-1-dev \ libssl-dev \ pkg-config - name: Checkout code at tag uses: actions/checkout@v7 with: ref: ${{ needs.prepare.outputs.tag }} fetch-depth: 0 - name: Setup Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 with: toolchain: stable cache: false - name: Rust Cache uses: swatinem/rust-cache@v2 with: prefix-key: "v3-${{ matrix.runner }}" - name: Extract all binary names id: cargo-meta run: | set -euo pipefail BIN_NAMES=$(cargo metadata --no-deps --format-version 1 \ | jq -r '.packages[].targets[] | select(.kind[] | contains("bin")) | .name') echo "bin_names<> $GITHUB_OUTPUT echo "$BIN_NAMES" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - name: Build all release binaries run: cargo build --release --locked - name: Package ZIP archive shell: bash run: | set -euo pipefail TAG="${{ needs.prepare.outputs.tag }}" ARCHIVE_NAME="pwsp-${TAG}-linux-${{ matrix.arch }}.zip" FILES=() while IFS= read -r BIN; do [ -z "$BIN" ] && continue FILES+=("target/release/$BIN") done <<< "${{ steps.cargo-meta.outputs.bin_names }}" zip -j "$ARCHIVE_NAME" "${FILES[@]}" - name: Upload ZIP artifact uses: actions/upload-artifact@v4 with: name: zip-archive-${{ matrix.arch }} path: pwsp-*.zip retention-days: 1 - name: Cache cargo-deb id: cache-cargo-deb uses: actions/cache@v6 with: path: ~/.cargo/bin/cargo-deb key: ${{ runner.os }}-${{ runner.arch }}-cargo-deb-v1 - name: Install cargo-deb if: steps.cache-cargo-deb.outputs.cache-hit != 'true' run: cargo install --locked cargo-deb - name: Create .deb package shell: bash run: | set -euo pipefail export PATH="$HOME/.cargo/bin:$PATH" cargo-deb -p pwsp-gui --no-build - name: Upload DEB artifact uses: actions/upload-artifact@v4 with: name: deb-package-${{ matrix.arch }} path: target/debian/*.deb retention-days: 1 publish-release: needs: [prepare, build-release] runs-on: ubuntu-latest steps: - name: Download all artifacts uses: actions/download-artifact@v8 with: path: ./dist merge-multiple: true - name: Upload artifacts to Release uses: softprops/action-gh-release@v3 with: token: ${{ secrets.GITHUB_TOKEN }} tag_name: ${{ needs.prepare.outputs.tag }} files: | ./dist/pwsp-*.zip ./dist/*.deb trigger-copr: needs: prepare runs-on: ubuntu-latest steps: - name: Install copr-cli run: pip install copr-cli - name: Trigger Copr Build env: COPR_CONFIG: ${{ secrets.COPR_CONFIG }} run: | mkdir -p ~/.config echo "$COPR_CONFIG" > ~/.config/copr copr-cli buildscm --nowait \ --clone-url https://github.com/arabianq/pipewire-soundpad.git \ --commit ${{ needs.prepare.outputs.tag }} \ --spec packages/rpm/pwsp.spec \ arabianq/pwsp build-apt-repo: needs: [prepare, build-release] runs-on: ubuntu-latest concurrency: gh-pages-deploy permissions: contents: write steps: - name: Checkout code uses: actions/checkout@v7 - name: Setup GPG id: gpg uses: crazy-max/ghaction-import-gpg@v7 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.GPG_PASSPHRASE }} - name: Download DEB artifacts uses: actions/download-artifact@v8 with: pattern: deb-package-* path: debs merge-multiple: true - name: Checkout existing gh-pages uses: actions/checkout@v7 with: ref: gh-pages path: gh-pages-branch continue-on-error: true - name: Generate APT Repository run: | sudo apt-get update sudo apt-get install -y reprepro mkdir -p apt-repo # Restore existing repository first so we don't lose old packages if [ -d "gh-pages-branch/apt" ]; then cp -r gh-pages-branch/apt/* apt-repo/ || true fi # Always rewrite the config and public key to ensure they are up-to-date mkdir -p apt-repo/conf cat < apt-repo/conf/distributions Origin: arabianq Label: PipeWire Soundpad Codename: stable Architectures: amd64 arm64 Components: main Description: APT Repository for PWSP SignWith: ${{ steps.gpg.outputs.fingerprint }} Origin: arabianq Label: PipeWire Soundpad Codename: nightly Architectures: amd64 arm64 Components: main Description: Nightly APT Repository for PWSP SignWith: ${{ steps.gpg.outputs.fingerprint }} EOF gpg --armor --export ${{ steps.gpg.outputs.fingerprint }} > apt-repo/pubkey.gpg cd apt-repo for deb in ../debs/*.deb; do if [ -f "$deb" ]; then echo "Adding $deb to APT repository..." reprepro includedeb stable "$deb" fi done - name: Deploy APT Repo to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./apt-repo destination_dir: apt keep_files: true