Skip to content

Release

Release #22

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../stackpit-${{ matrix.target }}.tar.gz stackpit
cd ../../..
shasum -a 256 stackpit-${{ matrix.target }}.tar.gz > stackpit-${{ matrix.target }}.tar.gz.sha256
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: stackpit-${{ matrix.target }}
path: |
stackpit-${{ matrix.target }}.tar.gz
stackpit-${{ matrix.target }}.tar.gz.sha256
deb:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Build deb package
run: cargo deb
- name: Upload deb artifact
uses: actions/upload-artifact@v7
with:
name: stackpit-deb
path: target/debian/*.deb
rpm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-generate-rpm
run: cargo install cargo-generate-rpm
- name: Build
run: cargo build --release
- name: Build rpm package
run: cargo generate-rpm
- name: Upload rpm artifact
uses: actions/upload-artifact@v7
with:
name: stackpit-rpm
path: target/generate-rpm/*.rpm
release:
needs: [build, deb, rpm]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v7
with:
merge-multiple: true
- name: Build release notes from changelog
run: |
version="${GITHUB_REF_NAME#v}"
awk -v ver="$version" '
$0 ~ "^## \\[" ver "\\]" { f = 1; next }
/^## \[/ { f = 0 }
f' CHANGELOG.md > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
echo "No CHANGELOG section for $version" >&2
exit 1
fi
prev="$(git tag --sort=-v:refname | awk -v cur="$GITHUB_REF_NAME" 'f { print; exit } $0 == cur { f = 1 }')"
if [ -n "$prev" ]; then
printf '\n**Full Changelog**: %s/%s/compare/%s...%s\n' \
"$GITHUB_SERVER_URL" "$GITHUB_REPOSITORY" "$prev" "$GITHUB_REF_NAME" >> RELEASE_NOTES.md
fi
cat RELEASE_NOTES.md
- name: Create release
uses: softprops/action-gh-release@v3
with:
body_path: RELEASE_NOTES.md
draft: false
files: |
stackpit-*.tar.gz
stackpit-*.tar.gz.sha256
*.deb
*.rpm