name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target ${{ matrix.target }}
- name: Archive binaries
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../temprs-${{ github.ref_name }}-${{ matrix.target }}.tar.gz temprs tp
- uses: actions/upload-artifact@v4
with:
name: temprs-${{ matrix.target }}
path: temprs-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: artifacts/*.tar.gz
homebrew:
name: Update Homebrew tap
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Compute SHA256 sums
id: sha
shell: bash
run: |
for f in artifacts/*.tar.gz; do
base=$(basename "$f")
sum=$(sha256sum "$f" | awk '{print $1}')
# e.g. temprs-vX.Y.Z-aarch64-apple-darwin.tar.gz → aarch64_apple_darwin
key=$(echo "$base" | sed 's/temprs-v[^-]*-//; s/\.tar\.gz//; s/-/_/g; s/\./_/g')
echo "${key}=${sum}" >> "$GITHUB_OUTPUT"
done
- uses: actions/checkout@v4
with:
repository: MenkeTechnologies/homebrew-menketech
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: tap
- name: Update formula
shell: bash
env:
VERSION: ${{ github.ref_name }}
run: |
# Strip leading 'v' from VERSION (e.g. v1.2.3 → 1.2.3).
VERSION="${VERSION#v}"
cd tap
cat > Formula/temprs.rb <<'FORMULA_HEAD'
class Temprs < Formula
desc "Temporary file stack manager — atomic flock-protected master record"
homepage "https://github.com/MenkeTechnologies/temprs"
license "MIT"
FORMULA_HEAD
cat >> Formula/temprs.rb <<EOF
version "${VERSION}"
on_macos do
on_arm do
url "https://github.com/MenkeTechnologies/temprs/releases/download/v${VERSION}/temprs-v${VERSION}-aarch64-apple-darwin.tar.gz"
sha256 "${{ steps.sha.outputs.aarch64_apple_darwin }}"
end
on_intel do
url "https://github.com/MenkeTechnologies/temprs/releases/download/v${VERSION}/temprs-v${VERSION}-x86_64-apple-darwin.tar.gz"
sha256 "${{ steps.sha.outputs.x86_64_apple_darwin }}"
end
end
on_linux do
on_intel do
url "https://github.com/MenkeTechnologies/temprs/releases/download/v${VERSION}/temprs-v${VERSION}-x86_64-unknown-linux-gnu.tar.gz"
sha256 "${{ steps.sha.outputs.x86_64_unknown_linux_gnu }}"
end
end
def install
bin.install "temprs"
bin.install "tp"
end
test do
assert_match "temprs", shell_output("#{bin}/temprs --version")
end
end
EOF
- name: Push formula update
run: |
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/temprs.rb
if git diff --cached --quiet; then
echo "no changes — formula already up to date"
exit 0
fi
git commit -m "temprs: bump to ${{ github.ref_name }}"
git push