name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Existing tag to build and attach binaries to (e.g. v1.0.2)"
required: true
permissions:
contents: write
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Ensure the GitHub release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.event.inputs.tag || github.ref_name }}
run: |
set -euo pipefail
if gh release view "$TAG" >/dev/null 2>&1; then
echo "Release $TAG already exists; reusing it."
else
gh release create "$TAG" --title "$TAG" --generate-notes
fi
upload:
name: ${{ matrix.target }}
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-apple-darwin
os: macos-14
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with:
ref: ${{ github.event.inputs.tag || github.ref }}
- uses: taiki-e/upload-rust-binary-action@f0d45ae91ee7b8ee928de7a9d04d893a08bcbec6 with:
bin: sopsy
target: ${{ matrix.target }}
archive: sopsy-$target
checksum: sha256
ref: refs/tags/${{ github.event.inputs.tag || github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
notify-tap:
name: refresh Homebrew formula
needs: upload
runs-on: ubuntu-latest
steps:
- name: Trigger tap update-formula workflow
env:
TAG: ${{ github.event.inputs.tag || github.ref_name }}
GH_TOKEN: ${{ secrets.TAP_DISPATCH_TOKEN }}
run: |
set -euo pipefail
if [ -z "${GH_TOKEN:-}" ]; then
echo "TAP_DISPATCH_TOKEN not set — skipping auto-update."
echo "Run the tap's update-formula workflow manually:"
echo " gh workflow run update-formula.yml -R kigster/homebrew-tap -f tag=$TAG"
exit 0
fi
gh api "repos/kigster/homebrew-tap/dispatches" \
-f "event_type=sopsy-release" \
-f "client_payload[tag]=$TAG"