Skip to content

Commit

Permalink
#32 Merge pull request from astropenguin/astropenguin/issue31
Browse files Browse the repository at this point in the history
Add workflow for updating formula
  • Loading branch information
astropenguin authored May 13, 2023
2 parents b3d4ba3 + bec27e1 commit dfd4468
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/formula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Homebrew formula

on:
release:
types:
- created

jobs:
job:
name: Homebrew formula
runs-on: ubuntu-latest
env:
FORMULA: "Formula/radex.rb"
SHA_REGEX: "[0-9a-f]{64}"
TAG_REGEX: "v[0-9]+\\.[0-9]+\\.[0-9]+"
steps:
- uses: actions/checkout@v3
- name: Update formula
run: |
TAG=${GITHUB_REF_NAME}
TAR=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/archive/${TAG}.tar.gz
SHA=$(curl -sSL ${TAR} | shasum -a 256 | cut -d " " -f 1)
sed -r -i.bak "s|${SHA_REGEX}|${SHA}|g" ${FORMULA}
sed -r -i.bak "s|${TAG_REGEX}|${TAG}|g" ${FORMULA}
- name: Push updates
run: |
TAG=${GITHUB_REF_NAME}
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
git add ${FORMULA}
git commit -m "Update formula for ${TAG}"
git push

0 comments on commit dfd4468

Please sign in to comment.