Skip to content

fix: gzip man page for Alpine (abuild requires compressed man pages) #13

fix: gzip man page for Alpine (abuild requires compressed man pages)

fix: gzip man page for Alpine (abuild requires compressed man pages) #13

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
arch: x86_64
platform: linux
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
arch: aarch64
platform: linux
- target: aarch64-apple-darwin
os: macos-latest
arch: aarch64
platform: darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cargo-zigbuild and Zig
if: matrix.platform == 'linux'
run: |
pip3 install ziglang
cargo install cargo-zigbuild
- name: Set version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build (zigbuild, Linux musl)
if: matrix.platform == 'linux'
run: cargo zigbuild --release --target ${{ matrix.target }}
- name: Build (native, macOS)
if: matrix.platform == 'darwin'
run: cargo build --release --target ${{ matrix.target }}
- name: Compress binary (zstd)
run: zstd -19 target/${{ matrix.target }}/release/batdoc -o batdoc-${{ matrix.platform }}-${{ matrix.arch }}.zst
- name: Create tar.gz archive
if: matrix.platform == 'linux'
run: |
mkdir -p batdoc_${{ env.VERSION }}_${{ matrix.arch }}
cp target/${{ matrix.target }}/release/batdoc batdoc_${{ env.VERSION }}_${{ matrix.arch }}/
cp target/man/batdoc.1 batdoc_${{ env.VERSION }}_${{ matrix.arch }}/
cp LICENSE README.md batdoc_${{ env.VERSION }}_${{ matrix.arch }}/
tar czf batdoc_${{ env.VERSION }}_${{ matrix.arch }}.tar.gz batdoc_${{ env.VERSION }}_${{ matrix.arch }}/
- name: Upload zstd artifact
uses: actions/upload-artifact@v4
with:
name: batdoc-${{ matrix.platform }}-${{ matrix.arch }}.zst
path: batdoc-${{ matrix.platform }}-${{ matrix.arch }}.zst
- name: Upload tar.gz artifact
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: batdoc_${{ env.VERSION }}_${{ matrix.arch }}.tar.gz
path: batdoc_${{ env.VERSION }}_${{ matrix.arch }}.tar.gz
packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build distro packages
run: docker build --build-arg VERSION=${{ env.VERSION }} -o pkg/out .
- name: List packages
run: ls -lh pkg/out/
- name: Remove debug packages
run: rm -f pkg/out/*-debug* pkg/out/*-debuginfo* pkg/out/*-debugsource*
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: distro-packages
path: pkg/out/
release:
needs: [build, packages]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: List release assets
run: ls -lh
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
batdoc-linux-x86_64.zst
batdoc-linux-aarch64.zst
batdoc-darwin-aarch64.zst
batdoc_*_x86_64.tar.gz
batdoc_*_aarch64.tar.gz
*.deb
*.rpm
*.apk
*.pkg.tar.zst
publish:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure SSH + Git
run: |
mkdir -p ~/.ssh
if [[ -n "${AUR_SSH_KEY:-}" ]]; then
echo "$AUR_SSH_KEY" | base64 -d > ~/.ssh/aur
chmod 600 ~/.ssh/aur
printf 'Host aur.archlinux.org\n IdentityFile ~/.ssh/aur\n User aur\n StrictHostKeyChecking accept-new\n' >> ~/.ssh/config
fi
if [[ -n "${TAP_SSH_KEY:-}" ]]; then
echo "$TAP_SSH_KEY" | base64 -d > ~/.ssh/tap
chmod 600 ~/.ssh/tap
printf 'Host github-tap\n HostName github.com\n IdentityFile ~/.ssh/tap\n User git\n StrictHostKeyChecking accept-new\n' >> ~/.ssh/config
git config --global url."git@github-tap:daemonp/homebrew-tap".insteadOf "git@github.com:daemonp/homebrew-tap.git"
fi
git config --global user.name "Damon Petta"
git config --global user.email "d@disassemble.net"
env:
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
TAP_SSH_KEY: ${{ secrets.TAP_SSH_KEY }}
- name: Publish to AUR + Homebrew
run: ./pkg/publish-aur.sh
env:
GH_TOKEN: ${{ github.token }}