Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Homebrew Tap Capability #520

Merged
merged 6 commits into from
Oct 9, 2024
Merged

Conversation

brett-hodges
Copy link
Contributor

  • updated platform-release.yaml to include steps required for homebrew tap functionality -updated .goreleaser.darwin.yaml to export MacOS binaries in both .zip and .tar.gz formats
  • added create-homebrew-recipe.awk
  • added kitops.rb.template

Description

Linked issues

- updated platform-release.yaml to include steps required for homebrew tap functionality
-updated .goreleaser.darwin.yaml to export MacOS binaries in both .zip and .tar.gz formats
- added create-homebrew-recipe.awk
- added kitops.rb.template
.github/workflows/platform-release.yaml Outdated Show resolved Hide resolved
.github/workflows/platform-release.yaml Outdated Show resolved Hide resolved
.github/workflows/platform-release.yaml Outdated Show resolved Hide resolved
.goreleaser.darwin.yaml Outdated Show resolved Hide resolved
suggestion from Angel

Co-authored-by: Angel Misevski <amisevsk@gmail.com>
@brett-hodges brett-hodges marked this pull request as draft October 8, 2024 21:00
@brett-hodges brett-hodges marked this pull request as ready for review October 8, 2024 21:16
@brett-hodges brett-hodges marked this pull request as draft October 9, 2024 14:55
Fixed indention issues
removed i386 from supported MacOS builds
@brett-hodges brett-hodges marked this pull request as ready for review October 9, 2024 15:09
Copy link
Contributor

@amisevsk amisevsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good -- I've left a few nitpicky comments here and there

I don't understand ruby or awk well enough to review those bits though.

@@ -1,6 +1,6 @@
name: Release with Platform builds

on:
on:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few trailing spaces on lines in this file (in VS Code, use cmd+k, cmd+z to trim)

run: |
shopt -s failglob
pushd dist
shasum -a 256 kitops-* > checksums.txt
mv checksums.txt kitops_${TAG_NAME}_checksums.txt
cp kitops_${TAG_NAME}_checksums.txt ../homebrew-files/.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary dot

Suggested change
cp kitops_${TAG_NAME}_checksums.txt ../homebrew-files/.
cp kitops_${TAG_NAME}_checksums.txt ../homebrew-files/

.github/workflows/platform-release.yaml Show resolved Hide resolved
Comment on lines +285 to +294
awk '
BEGIN { tag_name = ENVIRON["TAG_NAME"]; repo = ENVIRON["REPO"];}
/.tar.gz$/ {
print "\""$1"\"",
"\"https://github.com/" repo "/releases/download/" tag_name "/" $2 "\"",
$2,
tag_name }' kitops_${TAG_NAME}_checksums.txt |
awk '{ sub(/.tar.gz/, "", $3); print $1, $2, $3, $4 }' |
awk '{ sub(/kitops-/, "", $3); print $1, $2, $3, $4 }' |
awk '{sub(/v/, "", $4); print $1, $2, $3, $4 }' > homebrew-metadata.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm taking it on faith that this does whatever it is supposed to -- awk is a write-only language :D

Consider add comments describing what each step does?

Comment on lines +313 to +330
run: |
cp -f ./homebrew-files/homebrew-metadata.txt ./homebrew-kitops/.
cp -f ./homebrew-files/kitops.rb ./homebrew-kitops/.
pushd homebrew-kitops
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
PR_BRANCH="${{ github.ref_name }}-homebrew-tap-update"
git fetch origin main
git branch "$PR_BRANCH"
git checkout "$PR_BRANCH"
git pull origin --ff-only "${PR_BRANCH}" || true
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git add --all
git commit -m "homebrew: update Homebrew Tap Formula for ${{ github.ref_name }}"
git push origin "${PR_BRANCH}"
gh pr create --fill --base main --head "${PR_BRANCH}"
git checkout "${CURRENT_BRANCH}"
popd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could potentially be simpler using peter-evans/create-pull-request -- IIRC we use this elsewhere

@brett-hodges brett-hodges merged commit 4a7308a into main Oct 9, 2024
3 checks passed
@brett-hodges brett-hodges deleted the homebrew-tap-capabilities branch October 9, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants