release v0.8.7 #76
Workflow file for this run
This file contains 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** | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: "aarch64-linux-gnu-gcc" | |
CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG: "true" | |
permissions: | |
contents: read | |
jobs: | |
check-install: | |
name: Check cargo install succeeds | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: true | |
- name: Remove config | |
run: rm -rf ./.cargo | |
- name: Install Rust toolchain (stable) | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # stable | |
with: | |
toolchain: stable | |
- name: Override toolchain | |
run: rustup override set stable | |
- name: Install | |
run: cargo install --bin rq --path ./crates/rsonpath | |
env: | |
RUSTFLAGS: "--deny warnings" | |
build: | |
name: Build matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
target_triple: | |
- aarch64-unknown-linux-gnu | |
- i686-pc-windows-gnu | |
- i686-pc-windows-msvc | |
- i686-unknown-linux-gnu | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-gnu | |
- x86_64-pc-windows-msvc | |
- x86_64-unknown-linux-gnu | |
include: | |
- os: [self-hosted, linux, ARM64] | |
target_triple: aarch64-unknown-linux-gnu | |
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings" | |
- os: ubuntu-latest | |
target_triple: i686-unknown-linux-gnu | |
# This target needs special setup. | |
prologue-script: sudo apt update && sudo apt install gcc-multilib | |
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings" | |
- os: ubuntu-latest | |
target_triple: x86_64-unknown-linux-gnu | |
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings" | |
- os: macos-latest | |
target_triple: x86_64-apple-darwin | |
rustflags: "--deny warnings" | |
- os: windows-latest | |
target_triple: i686-pc-windows-gnu | |
# This target needs special setup with MinGW. | |
needs-mingw: x86 | |
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings" | |
- os: windows-latest | |
target_triple: i686-pc-windows-msvc | |
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings" | |
- os: windows-latest | |
target_triple: x86_64-pc-windows-gnu | |
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings" | |
- os: windows-latest | |
target_triple: x86_64-pc-windows-msvc | |
rustflags: "-C link-arg=-fuse-ld=lld --deny warnings" | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- name: Run prologue script | |
if: matrix.prologue-script != '' | |
run: ${{ matrix.prologue-script }} | |
- name: Cache restore (MinGW) | |
id: cache-restore-mingw | |
if: matrix.needs-mingw != '' | |
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
path: | | |
C:\ProgramData\chocolatey\lib\mingw | |
key: ${{ matrix.os }}-mingw-${{ matrix.needs-mingw }}-11-2 | |
- name: Set up MinGW ${{ matrix.needs-mingw }} | |
if: matrix.needs-mingw != '' && steps.cache-restore-mingw.outputs.cache-hit != 'true' | |
uses: egor-tensin/setup-mingw@84c781b557efd538dec66bde06988d81cd3138cf # v2.2.0 | |
with: | |
platform: ${{ matrix.needs-mingw }} | |
- name: Add MinGW to PATH | |
if: matrix.needs-mingw != '' | |
run: echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin" >> $env:GITHUB_PATH | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
submodules: true | |
- name: Install lld (Unix) | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt install lld | |
- name: Install Rust toolchain (stable) | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # stable | |
with: | |
toolchain: stable | |
target: ${{ matrix.target_triple }} | |
- name: Override toolchain | |
run: rustup override set stable | |
- name: Cache restore | |
id: cache-restore-cargo | |
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ matrix.os }}-${{ matrix.target_triple }}-cargo-${{ hashFiles('**/Cargo.toml') }}-release | |
- name: Build release (profile=distribution) for ${{ matrix.target-triple }} | |
run: cargo build --package rsonpath --profile=distribution --target ${{ matrix.target_triple }} | |
env: | |
RUSTFLAGS: ${{ matrix.rustflags }} | |
- name: Rename binary (Unix) | |
if: matrix.os != 'windows-latest' | |
run: rm -f target/distribution/rq-${{ matrix.target_triple }} && mv -f "target/${{ matrix.target_triple }}/distribution/rq" target/distribution/rq-${{ matrix.target_triple }} | |
- name: Rename binary (Windows) | |
if: matrix.os == 'windows-latest' | |
run: mv -Force "target/${{ matrix.target_triple }}/distribution/rq.exe" target/distribution/rq-${{ matrix.target_triple }}.exe | |
- name: Upload the binary as artifact | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: rq-${{ matrix.target_triple }} | |
# The * matches .exe if on windows and nothing otherwise. | |
path: target/distribution/rq-${{ matrix.target_triple }}* | |
if-no-files-found: error | |
github-release: | |
name: Release on GitHub | |
runs-on: ubuntu-latest | |
needs: [build, check-install] | |
outputs: | |
hashes: ${{ steps.hash.outputs.hashes }} | |
permissions: | |
contents: write | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- name: Download artifacts from build | |
uses: actions/download-artifact@87c55149d96e628cc2ef7e6fc2aab372015aec85 # v4.1.3 | |
with: | |
path: release/ | |
- name: Generate provenance subjects | |
id: hash | |
run: echo "hashes=$(sha256sum release/**/* | base64 -w0)" > $GITHUB_OUTPUT | |
- name: Generate provenance subjects sanity check | |
id: hash-sanity | |
run: echo "$(sha256sum release/**/* | base64 -w0)" | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 | |
with: | |
name: ${{ github.ref_name }} | |
files: release/**/* | |
fail_on_unmatched_files: true | |
prerelease: ${{ endsWith(github.ref, 'rc') || endsWith(github.ref, 'alpha') || endsWith(github.ref, 'beta') }} | |
draft: true | |
provenance: | |
needs: [github-release] | |
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | |
permissions: | |
actions: read | |
id-token: write | |
contents: write | |
with: | |
base64-subjects: ${{ needs.github-release.outputs.hashes }} | |
upload-assets: true | |
upload-tag-name: ${{ github.ref_name }} | |
draft-release: true | |
crates-io-release: | |
name: Release on crates.io | |
needs: [check-install, github-release, provenance] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | |
with: | |
egress-policy: audit | |
- name: Checkout sources | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Install Rust toolchain (stable) | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # stable | |
with: | |
toolchain: stable | |
- name: Publish rsonpath-syntax | |
run: cargo publish --token ${{ secrets.CRATES_TOKEN }} -p rsonpath-syntax --no-verify | |
- name: Publish rsonpath-lib | |
run: cargo publish --token ${{ secrets.CRATES_TOKEN }} -p rsonpath-lib --no-verify | |
- name: Publish rsonpath | |
run: cargo publish --token ${{ secrets.CRATES_TOKEN }} -p rsonpath --no-verify |