Skip to content

Commit

Permalink
add an gh action to update the homebrew formula
Browse files Browse the repository at this point in the history
  • Loading branch information
cdemers committed Oct 19, 2023
1 parent e7c6c49 commit 906a6f5
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/update-hombrew-formula.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 906a6f5

Please sign in to comment.