Skip to content

Commit be3030c

Browse files
committed
Distrbute prerelease super via Homebrew Cask
1 parent b623ff4 commit be3030c

2 files changed

Lines changed: 65 additions & 3 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: "Update Homewbrew Cask"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: closed
8+
workflow_dispatch:
9+
inputs:
10+
ref:
11+
description: 'Commit SHA to build'
12+
required: true
13+
default: 'main'
14+
type: string
15+
16+
jobs:
17+
build-and-update:
18+
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- id: checkout-ref
22+
run: |
23+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
24+
echo "ref=${{ github.event.inputs.ref }}" >> $GITHUB_OUTPUT
25+
else
26+
echo "ref=${{ github.event.pull_request.merge_commit_sha }}" >> $GITHUB_OUTPUT
27+
fi
28+
- uses: actions/checkout@v4
29+
with:
30+
ref: ${{ steps.checkout-ref.outputs.ref }}
31+
fetch-depth: 0
32+
- uses: actions/setup-go@v5
33+
with:
34+
go-version-file: go.mod
35+
- uses: goreleaser/goreleaser-action@v6
36+
with:
37+
args: release --snapshot --clean
38+
- uses: aws-actions/configure-aws-credentials@v5
39+
with:
40+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
41+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
42+
aws-region: us-east-2
43+
- run: |
44+
sha_hash=${{ steps.checkout-ref.outputs.ref }}
45+
short_hash=${sha_hash:0:9}
46+
for artifact in dist/super-${short_hash}*; do aws s3 cp $artifact s3://super-prereleases/${short_hash}/ ; done
47+
- uses: actions/checkout@v4
48+
with:
49+
repository: brimdata/homebrew-tap
50+
token: ${{ secrets.PAT_TOKEN }}
51+
path: homebrew-tap
52+
- run: |
53+
mkdir -p homebrew-tap/Casks
54+
cp dist/homebrew/Casks/super.rb homebrew-tap/Casks
55+
cd homebrew-tap
56+
git config --global user.name 'Brim Automation'
57+
git config --global user.email 'automation@brimdata.com'
58+
git add Casks/super.rb
59+
git commit -am "update super Homebrew Cask to ${{ steps.checkout-ref.outputs.ref }}" || true
60+
git push

.goreleaser.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ builds:
77
env:
88
- CGO_ENABLED=0
99
ldflags:
10-
- -s -X github.com/brimdata/super/cli.version={{ .Tag }}
10+
- -s -X github.com/brimdata/super/cli.version={{ .ShortCommit }}
1111
goarch:
1212
- amd64
1313
- arm64
@@ -16,7 +16,7 @@ builds:
1616
- windows
1717
- darwin
1818
archives:
19-
- name_template: "{{ .ProjectName }}-{{ .Tag }}.{{ .Os }}-{{ .Arch }}"
19+
- name_template: "{{ .ProjectName }}-{{ .ShortCommit }}.{{ .Os }}-{{ .Arch }}"
2020
format_overrides:
2121
- goos: windows
2222
formats: [ "zip" ]
@@ -36,9 +36,11 @@ homebrew_casks:
3636
homepage: https://github.com/brimdata/super
3737
description: |
3838
An analytics database that fuses structured and semi-structured data
39+
url:
40+
template: "https://super-prereleases.s3.us-east-2.amazonaws.com/{{ .ShortCommit }}/{{ .ArtifactName }}"
3941
checksum:
4042
name_template: 'super-checksums.txt'
4143
snapshot:
42-
version_template: "{{ incpatch .Version }}-{{ .ShortCommit }}"
44+
version_template: "{{ .ShortCommit }}"
4345
changelog:
4446
disable: true

0 commit comments

Comments
 (0)