0.11.0 #20
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: | |
workflow_dispatch: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
name: | |
- linux-x86-64-gnu | |
- linux-x86-64-musl | |
- linux-armhf-gnu | |
- linux-arm64-gnu | |
- mac-x86-64 | |
- mac-arm64 | |
- windows-x86-64 | |
- windows-arm64 | |
include: | |
- name: linux-x86-64-gnu | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
cross: false | |
experimental: false | |
- name: linux-x86-64-musl | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
cross: true | |
experimental: false | |
- name: linux-armhf-gnu | |
os: ubuntu-20.04 | |
target: armv7-unknown-linux-gnueabihf | |
cross: true | |
experimental: false | |
- name: linux-arm64-gnu | |
os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
cross: true | |
experimental: false | |
- name: mac-x86-64 | |
os: macos-latest | |
target: x86_64-apple-darwin | |
cross: false | |
experimental: false | |
- name: mac-arm64 | |
os: macos-11.0 | |
target: aarch64-apple-darwin | |
cross: true | |
experimental: true | |
- name: windows-x86-64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
cross: false | |
experimental: false | |
- name: windows-arm64 | |
os: windows-latest | |
target: aarch64-pc-windows-msvc | |
cross: true | |
experimental: true | |
name: Binaries for ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.experimental }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | |
- uses: actions/cache@v4 | |
if: startsWith(matrix.name, 'linux-') | |
with: | |
path: ~/.cargo/bin | |
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('.github/workflows/release.yml') }} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
toolchain: stable | |
profile: minimal | |
override: true | |
- uses: actions-rs/cargo@v1 | |
name: Build | |
with: | |
use-cross: ${{ matrix.cross }} | |
command: build | |
args: --release --locked --target ${{ matrix.target }} | |
- name: Extract version | |
shell: bash | |
run: | | |
set -euxo pipefail | |
version=$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2) | |
if [[ -z "$version" ]]; then | |
echo "Error: no version :(" | |
exit 1 | |
fi | |
echo "$version" > VERSION | |
- name: Package | |
shell: bash | |
run: | | |
set -euxo pipefail | |
ext="" | |
[[ "${{ matrix.name }}" == windows-* ]] && ext=".exe" | |
bin="target/${{ matrix.target }}/release/yq${ext}" | |
strip "$bin" || true | |
dst="yq-${{ matrix.target }}" | |
mkdir "$dst" | |
cp "$bin" "$dst/" | |
- name: Archive (tar) | |
if: '! startsWith(matrix.name, ''windows-'')' | |
shell: bash | |
run: | | |
set -euxo pipefail | |
dst="yq-${{ matrix.target }}" | |
tar cavf "$dst.tar.xz" "$dst" | |
- name: Archive (zip) | |
if: startsWith(matrix.name, 'windows-') | |
shell: bash | |
run: | | |
set -euxo pipefail | |
dst="yq-${{ matrix.target }}" | |
7z a "$dst.zip" "$dst" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: builds-${{ matrix.target }} | |
retention-days: 1 | |
path: | | |
yq-*.tar.xz | |
yq-*.zip | |
sign: | |
needs: build | |
name: Checksum and sign | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/bin | |
key: sign-tools-${{ hashFiles('.github/workflows/release.yml') }} | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: builds-* | |
merge-multiple: true | |
- name: Checksums with SHA512 | |
run: sha512sum yq-* | tee SHA512SUMS | |
- uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
files: | | |
yq-*.tar.xz | |
yq-*.zip | |
*SUMS* |