This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
Release 2.4.0 #54
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: | |
- mdcat-* | |
jobs: | |
build-binaries: | |
runs-on: '${{ matrix.os }}' | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
cargo_opts: "--no-default-features --features static" | |
- os: macOS-latest | |
target: x86_64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- run: sudo gem install asciidoctor | |
if: ${{ !contains(matrix.target, 'windows') }} | |
- run: sudo apt-get install musl-tools | |
if: ${{ contains(matrix.target, 'linux-musl') }} | |
- run: cargo build --locked --target '${{ matrix.target }}' ${{ matrix.cargo_opts }} --release | |
- run: asciidoctor -b manpage -a reproducible mdcat.1.adoc | |
if: ${{ !contains(matrix.target, 'windows') }} | |
- run: strip 'target/${{ matrix.target }}/release/mdcat' | |
if: ${{ !contains(matrix.target, 'windows') }} | |
- id: version | |
shell: bash | |
run: | | |
echo "version=$(cargo pkgid | cut -d'#' -f2 | cut -d: -f2)" >>"${GITHUB_OUTPUT}" | |
- id: package | |
shell: bash | |
run: ./scripts/package '${{ steps.version.outputs.version }}' '${{ matrix.target }}' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.package.outputs.name }} | |
path: ${{ steps.package.outputs.file }} | |
create-release: | |
runs-on: ubuntu-latest | |
needs: build-binaries | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts | |
- run: mkdir ./assets | |
- run: mv ./artifacts/*/*.{zip,tar.gz} ./assets | |
- run: b2sum *.{zip,tar.gz} > B2SUMS.txt | |
working-directory: assets | |
- id: version | |
shell: bash | |
run: | | |
echo "version=$(cargo pkgid | cut -d'#' -f2 | cut -d: -f2)" >>"${GITHUB_OUTPUT}" | |
- name: Extract changelog | |
shell: bash | |
run: | | |
awk -v r='${{ steps.version.outputs.version }}' \ | |
'/^\[[^]]*\]/{print $0}/^## \[[0-9]/ && match($0, /\[[0-9][^]]*\]/){if (r == substr($0, RSTART+1, RLENGTH-2)) { p=1; next } else { p=0 } }p' \ | |
CHANGELOG.md > ./CHANGELOG-release.md | |
cat CHANGELOG-release.md | |
- uses: softprops/action-gh-release@v2 | |
with: | |
name: mdcat-${{ steps.version.outputs.version }} | |
body_path: ./CHANGELOG-release.md | |
files: "./assets/*" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |