-
Notifications
You must be signed in to change notification settings - Fork 241
68 lines (67 loc) · 2.68 KB
/
homebrew_bump.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Homebrew Bump Formula
on:
schedule:
- cron: '23 17 * * *'
workflow_dispatch:
inputs:
reason:
description: Brief reason for running this workflow manually
required: false
default: not specified by user
type: string
jobs:
homebrew:
name: Bump Homebrew formula
runs-on: macos-latest
steps:
- id: latest_release
uses: pozetroninc/[email protected]
with:
repository: ${{ github.repository }}
excludes: prerelease, draft
token: ${{ secrets.FLYIO_FLYCTL_BOT_GITHUB_TOKEN }}
- run: 'echo "Latest release: ${{ steps.latest_release.outputs.release }}"'
- uses: actions/checkout@v4
- id: version_compare
run: |
set -exo pipefail
brew update
cur_brew_version=$(brew info flyctl --json --quiet | jq -r '.[0].versions.stable')
version_comp=$(./scripts/semver compare ${{ steps.latest_release.outputs.release }} ${cur_brew_version})
if [ "${version_comp}" = "1" ] ; then
echo "VERSION_STATUS=update_needed" >> "$GITHUB_OUTPUT"
else
echo "VERSION_STATUS=no_change" >> "$GITHUB_OUTPUT"
fi
- run: 'echo "VERSION_STATUS=${{ steps.version_compare.outputs.VERSION_STATUS }}"'
- uses: dawidd6/action-homebrew-bump-formula@v3
if: ${{ steps.version_compare.outputs.VERSION_STATUS == 'update_needed' }}
with:
token: ${{ secrets.FLYIO_FLYCTL_BOT_GITHUB_TOKEN }}
formula: flyctl
tag: ${{ steps.latest_release.outputs.release }}
force: false
- name: Check for slack secret
if: ${{ failure() && steps.version_compare.outputs.VERSION_STATUS == 'update_needed' }}
env:
SLACK_WEBHOOK_EXISTS: ${{ secrets.HOMEBREW_SLACK_WEBHOOK_URL != '' }}
run: if [ ${{ env.SLACK_WEBHOOK_EXISTS }} != "true" ] ; then echo "No webhook url :-(" ; fi
- name: Post failure to slack
if: ${{ failure() && steps.version_compare.outputs.VERSION_STATUS == 'update_needed' }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117
env:
SLACK_WEBHOOK_URL: ${{ secrets.HOMEBREW_SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":fire: flyctl bump homebrew formula failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}