From 8cc002dfcfbae6f951a79808b74f2758dab4ec3a Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Wed, 22 May 2024 13:14:12 -0600 Subject: [PATCH] chore: update release process to allow RCs (#94) ## Description Update the release process to allow for RCs to publish to Homebrew ## Related Issue Fixes #N/A ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [X] Other (security config, docs update, etc) ## Checklist before merging - [X] Test, docs, adr added or updated as needed - [X] [Contributor Guide Steps](https://github.com/defenseunicorns/maru-runner/blob/main/CONTRIBUTING.md) followed --- .github/actions/save-logs/action.yaml | 7 +------ .github/workflows/release.yaml | 21 +++++++++++++++++---- .goreleaser.yaml | 22 +++++++++++++++++++--- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/actions/save-logs/action.yaml b/.github/actions/save-logs/action.yaml index f03dd03..37cadf4 100644 --- a/.github/actions/save-logs/action.yaml +++ b/.github/actions/save-logs/action.yaml @@ -4,12 +4,7 @@ description: "Save debug logs" runs: using: composite steps: - - name: Fix log permissions - run: | - sudo chown $USER /tmp/runner-*.log || echo "" - shell: bash - - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: name: debug-log - path: /tmp/runner-*.log + path: /tmp/maru-*.log diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 690b041..bb7990f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -58,6 +58,10 @@ jobs: run: | chmod +x build/maru + - name: Run unit tests + run: | + make test-unit + - name: Run e2e tests run: | make test-e2e @@ -90,13 +94,22 @@ jobs: name: build-artifacts path: build/ + - name: Skip brew latest for pre-release tags + run: | + if [[ $GITHUB_REF_NAME == *"rc"* ]]; then + echo "BREW_NAME=maru@latest-rc" >> $GITHUB_ENV + else + echo "BREW_NAME=maru" >> $GITHUB_ENV + fi + - name: Get Brew tap repo token id: brew-tap-token - uses: peter-murray/workflow-application-token-action@dc0413987a085fa17d19df9e47d4677cf81ffef3 # v3.0.0 + uses: actions/create-github-app-token@f2acddfb5195534d487896a656232b016a682f3c # v1.9.0 with: - application_id: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_ID }} - application_private_key: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_SECRET }} - organization: defenseunicorns + app-id: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_ID }} + private-key: ${{ secrets.HOMEBREW_TAP_WORKFLOW_GITHUB_APP_SECRET }} + owner: defenseunicorns + repositories: homebrew-tap - name: Run GoReleaser uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0 diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 6534d46..2450cbe 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -44,14 +44,22 @@ changelog: use: github-native brews: - - name: maru + - name: "{{ .Env.BREW_NAME }}" 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://github.com/defenseunicorns/maru-runner" - description: "CLI for Unicorn Delivery Service" + description: "The Unicorn Task Runner" # 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. @@ -60,9 +68,17 @@ brews: 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://github.com/defenseunicorns/maru-runner" - description: "unicorn-flavored build tool" + description: "The Unicorn Task Runner" # Generate a GitHub release and publish the release for the tag release: