Skip to content

Commit

Permalink
fix: use gh CLI tool to upload homebrew formula
Browse files Browse the repository at this point in the history
Per https://gist.github.com/swinton/03e84635b45c78353b1f71e41007fc7c,
it seems like this might avoid the commit signature requirement. The
goreleaser code seems to use the same API, but since it specifies an
author I wonder if that prevents GitHub from automatically signing the
commit as the GitHub Actions bot.
  • Loading branch information
ericnorris committed May 19, 2021
1 parent 06382d3 commit ab42f14
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,17 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Commit homebrew forumulaa
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_TO_COMMIT: Formula/terraform-demux.rb
run: |
export MESSAGE="chore: regenerate $FILE_TO_COMMIT"
export SHA=$(git rev-parse --verify main:$FILE_TO_COMMIT)
export CONTENT=$(base64 -i $FILE_TO_COMMIT)
gh api --method PUT /repos/:owner/:repo/contents/$FILE_TO_COMMIT \
--field message="$MESSAGE" \
--field content="$CONTENT" \
--field encoding="base64" \
--field sha="$SHA"
7 changes: 2 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ brews:
owner: etsy
name: terraform-demux

folder: Formula

commit_author:
name: github-actions[bot]
email: 41898282+github-actions[bot]@users.noreply.github.com
folder: Formula
skip_upload: true

homepage: https://github.com/etsy/terraform-demux
description: A user-friendly launcher (à la Bazelisk) for Terraform.
Expand Down

0 comments on commit ab42f14

Please sign in to comment.