mirror of
https://github.com/darwincereska/homebrew-software.git
synced 2026-02-12 04:04:41 -05:00
63 lines
1.9 KiB
YAML
63 lines
1.9 KiB
YAML
name: Bump TTYmer Formula
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 * * * *'
|
|
|
|
jobs:
|
|
bump:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout tap repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Fetch latest release from GitHub
|
|
id: fetch
|
|
uses: actions/github-script@v6
|
|
with:
|
|
result-encoding: json
|
|
script: |
|
|
const release = await github.rest.repos.getLatestRelease({
|
|
owner: 'darwincereska',
|
|
repo: 'ttymer'
|
|
});
|
|
return {
|
|
version: release.data.tag_name,
|
|
url: release.data.tarball_url
|
|
};
|
|
|
|
- name: Download tarball and compute SHA256
|
|
id: compute
|
|
run: |
|
|
curl -L -o ttymer.tar.gz "${{ steps.fetch.outputs.url }}"
|
|
SHA256=$(sha256sum ttymer.tar.gz | awk '{ print $1 }')
|
|
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
|
|
|
|
- name: Update Formula
|
|
run: |
|
|
VERSION=${{ steps.fetch.outputs.version }}
|
|
SHA256=${{ steps.compute.outputs.sha256 }}
|
|
FORMULA=Formula/ttymer.rb
|
|
|
|
echo "Updating $FORMULA to version $VERSION"
|
|
|
|
sed -i "s|url \".*\"|url \"https://github.com/darwincereska/ttymer/archive/refs/tags/${VERSION}.tar.gz\"|g" "$FORMULA"
|
|
sed -i "s/sha256 \".*\"/sha256 \"$SHA256\"/g" "$FORMULA"
|
|
sed -i "s/version \".*\"/version \"${VERSION#v}\"/g" "$FORMULA" || echo "No version field to replace"
|
|
|
|
- name: Commit and push if changed
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
git config user.name "GitHub Actions"
|
|
git config user.email "actions@github.com"
|
|
git add Formula/ttymer.rb
|
|
if ! git diff --cached --quiet; then
|
|
VERSION=${{ steps.fetch.outputs.version }}
|
|
git commit -m "Auto-update ttymer to $VERSION"
|
|
git push
|
|
else
|
|
echo "No changes to commit"
|