Files

67 lines
2.4 KiB
YAML

name: Homebrew Bump
on:
release:
types: [released]
jobs:
enforce_stable_semver:
name: Require Stable Release Semver
runs-on: ubuntu-24.04
if: vars.ZROK_SKIP_HOMEBREW != 'true'
outputs:
version: ${{ steps.parse.outputs.version }}
steps:
- name: Parse Release Version
id: parse
shell: bash
run: |
if [[ "${GITHUB_REF_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "GITHUB_REF_NAME=${GITHUB_REF_NAME} is a stable release semver ref"
echo "version=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_OUTPUT
else
echo "GITHUB_REF_NAME=${GITHUB_REF_NAME} is not a stable release semver ref" >&2
exit 1
fi
brew_formula:
needs: enforce_stable_semver
if: (github.repository_owner == 'openziti' || github.repository_owner == 'openziti-test-kitchen') && vars.ZROK_SKIP_HOMEBREW != 'true'
runs-on: ubuntu-24.04
steps:
- name: Get Checksums File
shell: bash
run: |
curl -sSLf -o checksums.sha256.txt \
https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/checksums.sha256.txt
- name: Get Source Archive
shell: bash
run: |
curl -sSLf -o source-${{ github.ref_name }}.tar.gz \
https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/source-${{ github.ref_name }}.tar.gz
- name: Verify Source Archive Checksum
shell: bash
run: |
shasum --algorithm 256 --ignore-missing --check checksums.sha256.txt
- name: Extract Source Archive Checksum
id: source
shell: bash
run: |
CHECKSUM=$(grep -E "\bsource-${{ github.ref_name }}\.tar\.gz$" checksums.sha256.txt | cut -d' ' -f1)
echo "sha256=${CHECKSUM}" | tee -a "$GITHUB_OUTPUT"
- name: Upload Release Source Archive to Homebrew
uses: mislav/bump-homebrew-formula-action@v3.2
with:
formula-name: zrok2
formula-path: Formula/z/zrok2.rb
download-url: https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/source-${{ github.ref_name }}.tar.gz
download-sha256: ${{ steps.source.outputs.sha256 }}
homebrew-tap: ${{ vars.ZROK_BREW_TAP || 'Homebrew/homebrew-core' }}
env:
COMMITTER_TOKEN: ${{ secrets.BREW_COMMITTER_TOKEN }}