From 906a6f5bb32dc1322edb13cb2294a2ad431809b0 Mon Sep 17 00:00:00 2001 From: Charle Demers Date: Thu, 19 Oct 2023 17:10:51 -0400 Subject: [PATCH] add an gh action to update the homebrew formula --- .github/workflows/update-hombrew-formula.yaml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/update-hombrew-formula.yaml diff --git a/.github/workflows/update-hombrew-formula.yaml b/.github/workflows/update-hombrew-formula.yaml new file mode 100644 index 0000000..9eeadab --- /dev/null +++ b/.github/workflows/update-hombrew-formula.yaml @@ -0,0 +1,41 @@ +name: Update Homebrew Formula + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + +jobs: + update-formula: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install requests + + - name: Clone Homebrew Tap Repo + run: git clone https://github.com/cdemers/homebrew-tools-tap.git + + - name: Update Formula + run: | + VERSION=$(echo $GITHUB_REF | sed 's/refs\/tags\///') + sed -i "s/version \".*\"/version \"$VERSION\"/" homebrew-tools-tap/Formulas/question.rb + sed -i "s|url \".*\"|url \"https://github.com/cdemers/question/releases/download/$VERSION/question.tgz\"|" homebrew-tools-tap/Formulas/question.rb + + - name: Commit and Push Formula + run: | + cd homebrew-tools-tap + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add Formulas/question.rb + git commit -m "Update question formula to version $VERSION" + git push +