Skip to content

v1.2.1

v1.2.1 #23

Workflow file for this run

name: Update Homebrew Formula
on:
release:
types: [published]
jobs:
update-homebrew:
runs-on: ubuntu-latest
steps:
- name: Checkout main repo
uses: actions/checkout@v4
with:
repository: Matars/gitfetch
path: gitfetch
- name: Get version from pyproject.toml
id: get_version
run: |
VERSION=$(grep '^version =' gitfetch/pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download release tarball
run: |
curl -L -o release.tar.gz https://github.com/Matars/gitfetch/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz
- name: Calculate SHA256
id: sha256
run: |
SHA256=$(shasum -a 256 release.tar.gz | cut -d' ' -f1)
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
- name: Checkout tap repo
uses: actions/checkout@v4
with:
repository: Matars/homebrew-gitfetch
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: homebrew-tap
- name: Update formula
run: |
sed -i 's|url "https://github.com/Matars/gitfetch/archive/refs/tags/v.*"|url "https://github.com/Matars/gitfetch/archive/refs/tags/v${{ steps.get_version.outputs.version }}.tar.gz"|' homebrew-tap/Formula/gitfetch.rb
sed -i 's|sha256 ".*"|sha256 "${{ steps.sha256.outputs.sha256 }}"|' homebrew-tap/Formula/gitfetch.rb
# Update resource SHAs
CERTIFI_SHA=$(curl -s https://files.pythonhosted.org/packages/4c/5b/b6ce21586237c77ce67d01dc5507039d444b630dd76611bbca2d8e5dcd91/certifi-2025.10.5.tar.gz | shasum -a 256 | cut -d' ' -f1)
CHARSET_SHA=$(curl -s https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz | shasum -a 256 | cut -d' ' -f1)
IDNA_SHA=$(curl -s https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz | shasum -a 256 | cut -d' ' -f1)
READCHAR_SHA=$(curl -s https://files.pythonhosted.org/packages/dd/f8/8657b8cbb4ebeabfbdf991ac40eca8a1d1bd012011bd44ad1ed10f5cb494/readchar-4.2.1.tar.gz | shasum -a 256 | cut -d' ' -f1)
REQUESTS_SHA=$(curl -s https://files.pythonhosted.org/packages/c9/74/b3ff8e6c8446842c3f5c837e9c3dfcfe2018ea6ecef224c710c85ef728f4/requests-2.32.5.tar.gz | shasum -a 256 | cut -d' ' -f1)
URLLIB3_SHA=$(curl -s https://files.pythonhosted.org/packages/15/22/9ee70a2574a4f4599c47dd506532914ce044817c7752a79b6a51286319bc/urllib3-2.5.0.tar.gz | shasum -a 256 | cut -d' ' -f1)
sed -i "s|sha256 \".*\" # certifi|sha256 \"$CERTIFI_SHA\"|" homebrew-tap/Formula/gitfetch.rb
sed -i "s|sha256 \".*\" # charset-normalizer|sha256 \"$CHARSET_SHA\"|" homebrew-tap/Formula/gitfetch.rb
sed -i "s|sha256 \".*\" # idna|sha256 \"$IDNA_SHA\"|" homebrew-tap/Formula/gitfetch.rb
sed -i "s|sha256 \".*\" # readchar|sha256 \"$READCHAR_SHA\"|" homebrew-tap/Formula/gitfetch.rb
sed -i "s|sha256 \".*\" # requests|sha256 \"$REQUESTS_SHA\"|" homebrew-tap/Formula/gitfetch.rb
sed -i "s|sha256 \".*\" # urllib3|sha256 \"$URLLIB3_SHA\"|" homebrew-tap/Formula/gitfetch.rb
- name: Commit and push
run: |
cd homebrew-tap
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add Formula/gitfetch.rb
git commit -m "Update gitfetch to v${{ steps.get_version.outputs.version }}"
git push