Files
wehub-resource-sync e9a2f726c9
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.13) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:29:51 +08:00

44 lines
1.6 KiB
YAML

name: Update Homebrew formula
on:
release:
types: [published]
permissions:
contents: write
jobs:
update-formula:
if: ${{ !contains(github.ref_name, 'dev') && (!github.event.release.prerelease || contains(github.ref_name, 'rc')) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: main
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Calculate sha256
id: sha
run: |
sha=$(curl -sL "https://github.com/${{ github.repository }}/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz" | shasum -a 256 | cut -d' ' -f1)
echo "sha256=$sha" >> "$GITHUB_OUTPUT"
- name: Update formula
run: |
# Only update the formula's top-level source fields. Resource fields
# use deeper indentation and must keep their own checksums.
sed -i 's|^ url "https://github.com/.*/archive/refs/tags/v.*\.tar\.gz"$| url "https://github.com/${{ github.repository }}/archive/refs/tags/${{ github.ref_name }}.tar.gz"|' Formula/omlx.rb
sed -i 's|^ sha256 ".*"$| sha256 "${{ steps.sha.outputs.sha256 }}"|' Formula/omlx.rb
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/omlx.rb
git diff --cached --quiet && echo "no changes" && exit 0
git commit -m "formula: bump to ${{ steps.version.outputs.version }}"
git push