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

feat: add brew install for lula #707

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/goreleaser-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: GoReleaser Check

on:
push:
paths:
- '.goreleaser.yaml'
pull_request:
paths:
- '.goreleaser.yaml'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0

- name: Setup golang
uses: ./.github/actions/golang

- name: Install GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200
with:
install-only: true

- name: Run GoReleaser Check
run: goreleaser check
12 changes: 11 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,22 @@ jobs:
name: build-artifacts
path: bin/

- name: Get Brew tap repo token
id: brew-tap-token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
with:
app-id: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_ID }}
private-key: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_SECRET }}
owner: defenseunicorns
repositories: homebrew-tap

# Create the GitHub release notes
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
distribution: goreleaser
version: latest
args: release --clean --verbose
args: release --clean --verbose --config .goreleaser.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.brew-tap-token.outputs.token }}
39 changes: 38 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2

before:
hooks:
- go mod tidy
Expand Down Expand Up @@ -36,12 +38,47 @@ sboms:
- "sbom_{{ .ProjectName }}_{{ .Tag }}_{{- title .Os }}_{{ .Arch }}.sbom"

snapshot:
name_template: "{{ incpatch .Version }}-snapshot"
version_template: "{{ incpatch .Version }}-snapshot"

# Use the auto-generated changelog github provides
changelog:
use: github-native

brews:
- name: lula
repository:
owner: defenseunicorns
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
branch: "{{ .ProjectName }}-{{ .Tag }}"
pull_request:
enabled: true
base:
branch: main
owner: defenseunicorns
name: homebrew-tap
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
homepage: "https://lula.dev"
description: "The Compliance Validator"

# NOTE: We are using .Version instead of .Tag because homebrew has weird semver parsing rules and won't be able to
# install versioned releases that has a `v` character before the version number.
- name: "lula@{{ .Version }}"
repository:
owner: defenseunicorns
name: homebrew-tap
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
branch: "{{ .ProjectName }}-{{ .Tag }}"
pull_request:
enabled: true
base:
branch: main
owner: defenseunicorns
name: homebrew-tap
commit_msg_template: "Brew formula update for {{ .ProjectName }} versioned release {{ .Tag }}"
homepage: "https://lula.dev"
description: "The Compliance Validator"

# Generate a GitHub release and publish the release for the tag
release:
github:
Expand Down
7 changes: 5 additions & 2 deletions docs/community-and-contribution/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ The most important prefixes you should have in mind are:

### How can I influence the version number for a release?

PR titles should also follow this pattern and are linted using [commitlint](https://commitlint.js.org/). The PR title will determine the version bump. When a PR is merged (squashed) release-please will kick off a release PR. When that release PR is approved and merged, release-please will create a draft release. Once that draft release is published go-releaser with build and publish the assets.
PR titles should also follow this pattern and are linted using [commitlint](https://commitlint.js.org/). The PR title will determine the version bump. When a PR is merged (squashed) release-please will kick off a release PR. When that release PR is approved and merged, release-please will create a draft release. Once that draft release is published go-releaser with build and publish the assets, including creating a release in our Homebrew tap repository: [https://github.com/defenseunicorns/homebrew-tap](https://github.com/defenseunicorns/homebrew-tap)

- Pre-v1.0.0 release-please is configured to bump minors on breaking changes and patches otherwise. per [release-please-config](https://github.com/defenseunicorns/lula/blob/main/release-please-config.json)

### How do I fix a release issue?
Expand All @@ -42,8 +43,10 @@ The CHANGELOG is not required to be updated, only the release notes must be upda

#### Other issues and helpful tips

- Confirm that the goreleaser configuration is valid by using the [goreleaser cli](https://goreleaser.com/cmd/goreleaser_check/?h=valid)
- Manual approach: Confirm that the goreleaser configuration is valid by using the [goreleaser cli](https://goreleaser.com/cmd/goreleaser_check/?h=valid).

```sh
goreleaser check .goreleaser.yaml [flags]
```

- Automated approach: On Push and Pull Request the [GoReleaserGitHub Action Workflow](./github/workflows/goreleaser-check.yaml) will run the `goreleaser check` command