name: Release
on:
push:
tags:
- '*'
jobs:
build:
strategy:
matrix:
include:
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Run tests
run: cargo test
- name: Set env
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "BIN_NAME=urlendec" >> $GITHUB_ENV
- name: Zip artifacts
run: |
mkdir -p artifacts/
pushd artifacts
zip -j ${BIN_NAME}-${RELEASE_VERSION}-${{ matrix.target }}.zip ../target/${{ matrix.target }}/release/${BIN_NAME}
popd
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: artifacts/*.zip
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pandoc
run: sudo apt-get update && sudo apt-get install -y pandoc
- name: Generate manpage
run: |
mkdir -p artifacts/docs
pandoc doc/urlendec.1.md -s -t man -o artifacts/docs/urlendec.1
- uses: actions/upload-artifact@v4
with:
name: manpage
path: artifacts/docs/*
release:
needs: [build, generate-docs]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts/
- uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/**/*.zip"