Fix Linux/CI build: platform-specific keyring backends (no libdbus) #2
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 | |
| # Tag a release to trigger: git tag v0.1.0 && git push origin v0.1.0 | |
| on: | |
| push: | |
| tags: ["v*"] | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_TERM_COLOR: always | |
| BINARY: sb1 | |
| jobs: | |
| # Build a static-ish binary per platform and attach a tarball to the Release. | |
| binaries: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install cross-linker (Linux aarch64) | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" | |
| - name: Build | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package | |
| run: | | |
| os=$(echo "${{ matrix.target }}" | grep -q apple && echo darwin || echo linux) | |
| arch=$(echo "${{ matrix.target }}" | cut -d- -f1) | |
| tar -C "target/${{ matrix.target }}/release" -czf "${BINARY}-${os}-${arch}.tar.gz" "${BINARY}" | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: "${{ env.BINARY }}-*.tar.gz" | |
| # Publish to crates.io. Requires the CARGO_REGISTRY_TOKEN repo secret. | |
| # Idempotent: skips if this version is already published (so a manual | |
| # `cargo publish` and the tag-triggered run don't collide). | |
| crates: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Publish if this version is not already on crates.io | |
| run: | | |
| meta=$(cargo metadata --no-deps --format-version 1) | |
| name=$(echo "$meta" | python3 -c "import sys,json;print(json.load(sys.stdin)['packages'][0]['name'])") | |
| version=$(echo "$meta" | python3 -c "import sys,json;print(json.load(sys.stdin)['packages'][0]['version'])") | |
| # Query the crates.io API directly (no index lag). | |
| code=$(curl -s -o /dev/null -w "%{http_code}" "https://crates.io/api/v1/crates/$name/$version") | |
| if [ "$code" = "200" ]; then | |
| echo "$name v$version already on crates.io — skipping." | |
| else | |
| cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| fi |