mirror of
https://github.com/darwincereska/homebrew-software.git
synced 2026-02-12 04:04:41 -05:00
61 lines
2.4 KiB
YAML
61 lines
2.4 KiB
YAML
name: Bump NoteVC Formula
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
bump:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Get release version
|
|
id: get_release
|
|
run: |
|
|
version=${GITHUB_REF_NAME#v}
|
|
echo "version=$version" >> $GITHUB_OUTPUT
|
|
|
|
- name: Download binaries
|
|
id: download
|
|
run: |
|
|
version=${{ steps.get_release.outputs.version }}
|
|
mkdir -p tmp
|
|
curl -L -o tmp/notevc-macos-arm64 "https://github.com/darwincereska/notevc/releases/download/v${version}/notevc-macos-arm64"
|
|
curl -L -o tmp/notevc-linux-x64 "https://github.com/darwincereska/notevc/releases/download/v${version}/notevc-linux-x64"
|
|
mac_hash=$(sha256sum tmp/notevc-macos-arm64 | cut -d' ' -f1)
|
|
linux_hash=$(sha256sum tmp/notevc-linux-x64 | cut -d' ' -f1)
|
|
echo "mac_hash=$mac_hash" >> $GITHUB_OUTPUT
|
|
echo "linux_hash=$linux_hash" >> $GITHUB_OUTPUT
|
|
|
|
- name: Update Formula
|
|
run: |
|
|
version=${{ steps.get_release.outputs.version }}
|
|
mac_hash=${{ steps.download.outputs.mac_hash }}
|
|
linux_hash=${{ steps.download.outputs.linux_hash }}
|
|
|
|
sed -i "s/version \".*\"/version \"${version}\"/" Formula/notevc.rb
|
|
sed -i "s|notevc/releases/download/v.*/notevc-macos-arm64\"|notevc/releases/download/v${version}/notevc-macos-arm64\"|" Formula/notevc.rb
|
|
sed -i "s|notevc/releases/download/v.*/notevc-linux-x64\"|notevc/releases/download/v${version}/notevc-linux-x64\"|" Formula/notevc.rb
|
|
|
|
awk -v mac_hash="$mac_hash" -v linux_hash="$linux_hash" '
|
|
/if OS.mac\?/ {print; getline; sub(/sha256 ".*"/, "sha256 \""mac_hash"\""); print; next}
|
|
/elsif OS.linux\?/ {print; getline; sub(/sha256 ".*"/, "sha256 \""linux_hash"\""); print; next}
|
|
{print}
|
|
' Formula/notevc.rb > Formula/tmp.rb && mv Formula/tmp.rb Formula/notevc.rb
|
|
|
|
- name: Commit and push changes
|
|
run: |
|
|
version=${{ steps.get_release.outputs.version }}
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add Formula/notevc.rb
|
|
git diff --quiet && echo "No changes detected." && exit 0
|
|
git commit -m "bump(notevc): updated version to ${version}"
|
|
git push
|