name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-22.04-arm, target: aarch64-unknown-linux-gnu }
- { os: macos-latest, target: aarch64-apple-darwin }
- { os: macos-latest, target: x86_64-apple-darwin }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Check that the tag matches the crate version
shell: bash
run: grep -q "^version = \"${GITHUB_REF_NAME#v}\"$" Cargo.toml
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
name="pdfops-${GITHUB_REF_NAME}-${{ matrix.target }}"
mkdir "$name"
cp README.md LICENSE "$name/"
if [ "${{ runner.os }}" = "Windows" ]; then
cp "target/${{ matrix.target }}/release/pdfops.exe" "$name/"
7z a "$name.zip" "$name"
else
cp "target/${{ matrix.target }}/release/pdfops" "$name/"
tar czf "$name.tar.gz" "$name"
fi
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: |
pdfops-*.tar.gz
pdfops-*.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- run: sha256sum pdfops-* > SHA256SUMS
- run: gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag --generate-notes pdfops-* SHA256SUMS
env:
GH_TOKEN: ${{ github.token }}