Bump Formulae and Casks #460
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
name: Bump Formulae and Casks | |
on: | |
schedule: | |
- cron: "20 8,20 * * *" | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
jobs: | |
bump: | |
name: Bump Homebrew Formulae and Casks | |
runs-on: macos-14 | |
steps: | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
with: | |
core: false | |
cask: false | |
test-bot: false | |
- name: Cache Homebrew Bundler RubyGems | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.set-up-homebrew.outputs.gems-path }} | |
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} | |
restore-keys: ${{ runner.os }}-rubygems- | |
- name: Install Homebrew Bundler RubyGems | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: brew install-bundler-gems | |
- name: Configure Git User | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Bump Formulae | |
env: | |
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.MAA_HOMEBREW_BUMP_PR }} | |
run: | | |
formulae=$(brew livecheck --quiet --formula --json --tap="$GITHUB_REPOSITORY") | |
len=$(echo "$formulae" | jq length) | |
for ((i=0; i < "$len"; i++)); do | |
formula=$(echo "$formulae" | jq -r ".[$i].formula") | |
version=$(echo "$formulae" | jq -r ".[$i].version.latest") | |
outdated=$(echo "$formulae" | jq -r ".[$i].version.outdated") | |
if [ "$outdated" = "true" ]; then | |
echo "Bumping \`$formula\` to \`$version\`" | |
brew bump-formula-pr "maaassistantarknights/tap/$formula" \ | |
--no-audit \ | |
--no-browse \ | |
--version="$version" \ | |
--message="Bump \`$formula\` to \`$version\`" | |
else | |
echo "\`$formula\` is up to date" | |
fi | |
done | |
- name: Bump Casks | |
env: | |
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.MAA_HOMEBREW_BUMP_PR }} | |
run: | | |
casks=$(brew livecheck --quiet --cask --json --tap="$GITHUB_REPOSITORY") | |
len=$(echo "$casks" | jq length) | |
for ((i=0; i < "$len"; i++)); do | |
cask=$(echo "$casks" | jq -r ".[$i].cask") | |
version=$(echo "$casks" | jq -r ".[$i].version.latest") | |
outdated=$(echo "$casks" | jq -r ".[$i].version.outdated") | |
if [ "$outdated" = "true" ]; then | |
echo "Bumping \`$cask\` to \`$version\`" | |
brew bump-cask-pr "maaassistantarknights/tap/$cask" \ | |
--no-audit \ | |
--no-browse \ | |
--version="$version" \ | |
--message="Bump \`$cask\` to \`$version\`" | |
else | |
echo "\`$cask\` is up to date" | |
fi | |
done |