Skip to content

Version 1.9.3

Version 1.9.3 #20

Workflow file for this run

name: Build and release
on:
push:
tags: v*.*.*
env:
CARGO_TERM_COLOR: always
NAME: tlrc
defaults:
run:
shell: bash
permissions:
contents: write
jobs:
release:
name: Create the release
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Create the release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create --title "$GITHUB_REF_NAME" "$GITHUB_REF_NAME"
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
needs: release
permissions:
contents: write # to upload assets to releases
attestations: write # to upload assets attestation for build provenance
id-token: write # grant additional permission to attestation action to mint the OIDC token permission
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install musl libc
if: ${{ contains(matrix.target, 'musl') }}
run: sudo apt install musl-tools
- name: Set up Rust
run: rustup update stable && rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Create the archive
env:
BIN: tldr
run: |
if [[ ${{ matrix.os }} == *windows* ]]; then
BIN="$BIN.exe"
ARCHIVER=(7z a)
EXTENSION="zip"
else
ARCHIVER=(tar -czvf)
EXTENSION="tar.gz"
fi
mv "target/${{ matrix.target }}/release/$BIN" "$BIN"
"${ARCHIVER[@]}" "$NAME-$GITHUB_REF_NAME-${{ matrix.target }}.$EXTENSION" "$BIN" LICENSE README.md tldr.1 completions
- name: Upload the archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "$GITHUB_REF_NAME" "$NAME"-*
- name: Attest release files
id: attest
uses: actions/attest-build-provenance@v1
with:
subject-path: '*.zip, *.tar.gz'