From bec27e1c967f41c68e1072bcbb26b847d436e485 Mon Sep 17 00:00:00 2001 From: Akio Taniguchi Date: Sat, 13 May 2023 13:06:08 +0000 Subject: [PATCH] #31 Add workflow for formula --- .github/workflows/formula.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/formula.yml diff --git a/.github/workflows/formula.yml b/.github/workflows/formula.yml new file mode 100644 index 0000000..a5214af --- /dev/null +++ b/.github/workflows/formula.yml @@ -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