diff --git a/.github/workflows/homebrew-update.yaml b/.github/workflows/homebrew-update.yaml new file mode 100644 index 000000000..ed3f0357a --- /dev/null +++ b/.github/workflows/homebrew-update.yaml @@ -0,0 +1,60 @@ +name: "Update Homewbrew Cask" + +on: + pull_request: + branches: + - main + types: closed + workflow_dispatch: + inputs: + ref: + description: 'Commit SHA to build' + required: true + default: 'main' + type: string + +jobs: + build-and-update: + if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-22.04 + steps: + - id: checkout-ref + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "ref=${{ github.event.inputs.ref }}" >> $GITHUB_OUTPUT + else + echo "ref=${{ github.event.pull_request.merge_commit_sha }}" >> $GITHUB_OUTPUT + fi + - uses: actions/checkout@v4 + with: + ref: ${{ steps.checkout-ref.outputs.ref }} + fetch-depth: 0 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - uses: goreleaser/goreleaser-action@v6 + with: + args: release --snapshot --clean + - uses: aws-actions/configure-aws-credentials@v5 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + - run: | + sha_hash=${{ steps.checkout-ref.outputs.ref }} + short_hash=${sha_hash:0:9} + for artifact in dist/super-${short_hash}*; do aws s3 cp $artifact s3://super-prereleases/${short_hash}/ ; done + - uses: actions/checkout@v4 + with: + repository: brimdata/homebrew-tap + token: ${{ secrets.PAT_TOKEN }} + path: homebrew-tap + - run: | + mkdir -p homebrew-tap/Casks + cp dist/homebrew/Casks/super.rb homebrew-tap/Casks + cd homebrew-tap + git config --global user.name 'Brim Automation' + git config --global user.email 'automation@brimdata.com' + git add Casks/super.rb + git commit -am "update super Homebrew Cask to ${{ steps.checkout-ref.outputs.ref }}" || true + git push diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c0e711e73..73f336104 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -7,7 +7,7 @@ builds: env: - CGO_ENABLED=0 ldflags: - - -s -X github.com/brimdata/super/cli.version={{ .Tag }} + - -s -X github.com/brimdata/super/cli.version={{ .ShortCommit }} goarch: - amd64 - arm64 @@ -16,7 +16,7 @@ builds: - windows - darwin archives: - - name_template: "{{ .ProjectName }}-{{ .Tag }}.{{ .Os }}-{{ .Arch }}" + - name_template: "{{ .ProjectName }}-{{ .ShortCommit }}.{{ .Os }}-{{ .Arch }}" format_overrides: - goos: windows formats: [ "zip" ] @@ -36,9 +36,11 @@ homebrew_casks: homepage: https://github.com/brimdata/super description: | An analytics database that fuses structured and semi-structured data + url: + template: "https://super-prereleases.s3.us-east-2.amazonaws.com/{{ .ShortCommit }}/{{ .ArtifactName }}" checksum: name_template: 'super-checksums.txt' snapshot: - version_template: "{{ incpatch .Version }}-{{ .ShortCommit }}" + version_template: "{{ .ShortCommit }}" changelog: disable: true