Skip to content

Commit 52403e4

Browse files
committed
Fix homebrew release action
1 parent 6ad791e commit 52403e4

File tree

1 file changed

+53
-10
lines changed

1 file changed

+53
-10
lines changed

.github/workflows/bump-homebrew.yaml

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,65 @@ on:
33
workflows: ["Build"]
44
types:
55
- completed
6+
67
name: Bump homebrew
8+
79
jobs:
810
publish:
911
name: Update homebrew-core
10-
runs-on: macos-latest
12+
runs-on: ubuntu-latest
13+
1114
steps:
12-
- uses: actions/checkout@v6
15+
# Checkout your fork
16+
- name: Checkout fork
17+
uses: actions/checkout@v4
1318
with:
19+
repository: TomWright/homebrew-core
20+
token: ${{ secrets.GH_HOMEBREW_TOKEN }}
1421
fetch-depth: 0
15-
- name: Set env
16-
run: echo "RELEASE_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
17-
- name: Homebrew bump formula
18-
uses: dawidd6/action-homebrew-bump-formula@v7
22+
23+
# Get latest release tag from upstream repo
24+
- name: Set release version
25+
run: |
26+
RELEASE_VERSION=$(git describe --tags --abbrev=0)
27+
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
28+
NUMERIC_VERSION="${RELEASE_VERSION#v}"
29+
echo "NUMERIC_VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV
30+
31+
# Fetch tarball and compute sha256
32+
- name: Fetch tarball and checksum
33+
run: |
34+
URL="https://github.com/TomWright/dasel/archive/refs/tags/${RELEASE_VERSION}.tar.gz"
35+
curl -L -o dasel.tar.gz "$URL"
36+
SHA=$(sha256sum dasel.tar.gz | awk '{print $1}')
37+
echo "SHA=$SHA" >> $GITHUB_ENV
38+
39+
# Update formula in-place
40+
- name: Update formula
41+
run: |
42+
FORMULA="Formula/d/dasel.rb"
43+
sed -i \
44+
-e "s|refs/tags/v[0-9.]*|refs/tags/${RELEASE_VERSION}|" \
45+
-e "s|sha256 \".*\"|sha256 \"$SHA\"|" \
46+
"$FORMULA"
47+
48+
# Open PR from your fork to upstream
49+
- name: Create PR
50+
id: pr
51+
uses: peter-evans/create-pull-request@v6
1952
with:
2053
token: ${{ secrets.GH_HOMEBREW_TOKEN }}
21-
formula: dasel
22-
tap: homebrew/core
23-
tag: ${{ env.RELEASE_VERSION }}
24-
force: true
54+
branch: dasel-${{ env.NUMERIC_VERSION }}
55+
base: main
56+
title: "dasel ${{ env.NUMERIC_VERSION }}"
57+
body: |
58+
Automated bump to dasel ${{ env.NUMERIC_VERSION }}.
59+
60+
Release notes:
61+
https://github.com/TomWright/dasel/releases/tag/${{ env.RELEASE_VERSION }}
62+
repository: Homebrew/homebrew-core
63+
64+
# Print PR URL
65+
- name: Print PR link
66+
run: |
67+
echo "PR created: ${{ steps.pr.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)