-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3741bb8
commit 1a6406d
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Update Homebrew Formula | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
update-formula: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'therealpaulgg/homebrew-ssh-sync' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update Homebrew formula | ||
run: | | ||
# Example commands to update formula | ||
# You'll need a script that updates your formula file with the new version and sha256 | ||
# This might involve downloading the release tarball, calculating its sha256, and updating the formula file accordingly | ||
sh update_formula.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Commit and push | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git commit -am "Update formula to version ${{ github.event.release.tag_name }}" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# Replace these variables with your actual data | ||
GITHUB_REPO="therealpaulgg/ssh-sync" # Your GitHub username and repository name | ||
FORMULA_PATH="Formula/ssh-sync.rb" # Path to your formula in the tap | ||
TAP_REPO="therealpaulgg/homebrew-ssh-sync" # Your tap repository | ||
|
||
# Fetch the latest release data from GitHub | ||
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/$GITHUB_REPO/releases/latest") | ||
|
||
# Extract the version and tarball URL from the release data | ||
VERSION=$(echo "$LATEST_RELEASE" | jq -r '.tag_name') | ||
TARBALL_URL=$(echo "$LATEST_RELEASE" | jq -r '.tarball_url') | ||
|
||
# Download the tarball and calculate its SHA256 | ||
SHA256=$(curl -Ls $TARBALL_URL | shasum -a 256 | awk '{print $1}') | ||
|
||
# Update the formula with the new version and sha256 | ||
sed -i "" "s|url \".*\"|url \"$TARBALL_URL\"|g" $FORMULA_PATH | ||
sed -i "" "s|sha256 \".*\"|sha256 \"$SHA256\"|g" $FORMULA_PATH |