Skip to content

Commit

Permalink
Merge pull request redpanda-data#13145 from vbotbuildovich/backport-p…
Browse files Browse the repository at this point in the history
…r-13101-v23.2.x-222

[v23.2.x] Consolidate goreleaser config and GHA workflows
  • Loading branch information
ivotron authored Aug 31, 2023
2 parents 1b5bfec + 717e90a commit c8ed0e4
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 184 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/golang-binaries-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright 2023 Redpanda Data, Inc.
#
# Use of this software is governed by the Business Source License
# included in the file licenses/BSL.md
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software will be governed
# by the Apache License, Version 2.0

name: release-go-binaries
on:
push:
tags:
- 'v2**'

jobs:
release:
name: Release using goreleaser
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install quill
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b "$HOME/.local/bin" v0.4.1
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: stable

- name: Create empty release notes
run: |
echo "" > /tmp/empty_notes
- name: Invoke goreleaser
uses: goreleaser/goreleaser-action@v4
env:
QUILL_SIGN_P12: ${{ secrets.QUILL_SIGN_P12_BASE64 }}
QUILL_SIGN_PASSWORD: ${{ secrets.QUILL_SIGN_PASSWORD }}
QUILL_NOTARY_KEY_ID: ${{ secrets.QUILL_NOTARY_KEY_ID }}
QUILL_NOTARY_KEY: ${{ secrets.QUILL_NOTARY_KEY_BASE64 }}
QUILL_NOTARY_ISSUER: ${{ secrets.QUILL_NOTARY_ISSUER }}
GITHUB_TOKEN: ${{ secrets.VBOT_GITHUB_API_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
workdir: src/go/
args: release --clean --release-notes /tmp/empty_notes

- name: Archive quill output
if: failure()
uses: actions/upload-artifact@v3
with:
name: quill-logs
path: src/go/dist/quill-*.log

notify-release-failure:
name: Notify of release failures
runs-on: ubuntu-latest
if: failure()
needs: [release]
steps:
- name: Notify release failure
uses: slackapi/slack-github-action@v1.21.0
with:
channel-id: ${{ secrets.INTERNAL_RELEASES_SLACK_CHANNEL }}
slack-message: "ERROR: release of `rpk` binaries for `${{ github.ref_name }}` failed in ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.VBOTBUILDOVICH_SLACK_BOT_TOKEN }}
62 changes: 0 additions & 62 deletions .github/workflows/redpanda-migration-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
name: cluster-to-redpanda-migration
on:
push:
tags:
- 'v2**'
branches:
- '*'
pull_request:
Expand Down Expand Up @@ -41,64 +39,4 @@ jobs:
working-directory: src/go/cluster-to-redpanda-migration/
run: go test -v ./...

release:
name: Release using goreleaser
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install quill
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b "$HOME/.local/bin" v0.2.0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: stable

- name: Create empty release notes
run: |
echo "" > /tmp/empty_notes

- name: Invoke goreleaser
uses: goreleaser/goreleaser-action@v4
env:
QUILL_SIGN_P12: ${{ secrets.QUILL_SIGN_P12_BASE64 }}
QUILL_SIGN_PASSWORD: ${{ secrets.QUILL_SIGN_PASSWORD }}
QUILL_NOTARY_KEY_ID: ${{ secrets.QUILL_NOTARY_KEY_ID }}
QUILL_NOTARY_KEY: ${{ secrets.QUILL_NOTARY_KEY_BASE64 }}
QUILL_NOTARY_ISSUER: ${{ secrets.QUILL_NOTARY_ISSUER }}
GITHUB_TOKEN: ${{ secrets.VBOT_GITHUB_API_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
workdir: src/go/cluster-to-redpanda-migration/
args: release --clean --release-notes /tmp/empty_notes

- name: Archive quill output
if: failure()
uses: actions/upload-artifact@v3
with:
name: quill-logs
path: src/go/cluster-to-redpanda-migration/dist/quill-*.log

notify-release-failure:
name: Notify of release failures
runs-on: ubuntu-latest
if: failure()
needs: [release]
steps:
- name: Notify release failure
uses: slackapi/slack-github-action@v1.21.0
with:
channel-id: ${{ secrets.INTERNAL_RELEASES_SLACK_CHANNEL }}
slack-message: "ERROR: release of `cluster-to-redpanda-migration` binaries for `${{ github.ref_name }}` failed in ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.VBOTBUILDOVICH_SLACK_BOT_TOKEN }}
64 changes: 0 additions & 64 deletions .github/workflows/rpk-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
name: rpk
on:
push:
tags:
- 'v2**'
branches:
- '*'
pull_request:
Expand Down Expand Up @@ -40,65 +38,3 @@ jobs:
- name: Run tests
working-directory: src/go/rpk/
run: go test -v ./...

release:
name: Release using goreleaser
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install quill
run: |
mkdir -p "$HOME/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b "$HOME/.local/bin" v0.4.1
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: stable

- name: Create empty release notes
run: |
echo "" > /tmp/empty_notes
- name: Invoke goreleaser
uses: goreleaser/goreleaser-action@v4
env:
QUILL_SIGN_P12: ${{ secrets.QUILL_SIGN_P12_BASE64 }}
QUILL_SIGN_PASSWORD: ${{ secrets.QUILL_SIGN_PASSWORD }}
QUILL_NOTARY_KEY_ID: ${{ secrets.QUILL_NOTARY_KEY_ID }}
QUILL_NOTARY_KEY: ${{ secrets.QUILL_NOTARY_KEY_BASE64 }}
QUILL_NOTARY_ISSUER: ${{ secrets.QUILL_NOTARY_ISSUER }}
GITHUB_TOKEN: ${{ secrets.VBOT_GITHUB_API_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ github.ref_name }}
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
workdir: src/go/rpk/
args: release --clean --release-notes /tmp/empty_notes

- name: Archive quill output
if: failure()
uses: actions/upload-artifact@v3
with:
name: quill-logs
path: src/go/rpk/dist/quill-*.log

notify-release-failure:
name: Notify of release failures
runs-on: ubuntu-latest
if: failure()
needs: [release]
steps:
- name: Notify release failure
uses: slackapi/slack-github-action@v1.21.0
with:
channel-id: ${{ secrets.INTERNAL_RELEASES_SLACK_CHANNEL }}
slack-message: "ERROR: release of `rpk` binaries for `${{ github.ref_name }}` failed in ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.VBOTBUILDOVICH_SLACK_BOT_TOKEN }}
52 changes: 47 additions & 5 deletions src/go/rpk/.goreleaser.yaml → src/go/.goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
project_name: rpk
builds:
- id: windows-and-linux
- id: rpk-windows-and-linux
dir: ./rpk/
main: ./cmd/rpk
binary: rpk
ldflags:
Expand All @@ -16,7 +17,8 @@ builds:
- amd64
- arm64
# we need separate build for darwin to sign/notarize using quill
- id: darwin
- id: rpk-darwin
dir: ./rpk/
main: ./cmd/rpk
binary: rpk
ldflags:
Expand All @@ -40,13 +42,51 @@ builds:
- cmd: quill sign-and-notarize "{{ .Path }}" --dry-run={{ .IsSnapshot }} --ad-hoc={{ .IsSnapshot }} -vv
env:
- QUILL_LOG_FILE=dist/quill-{{ .Target }}.log
- id: migration-tool-windows-and-linux
dir: ./cluster-to-redpanda-migration/
main: ./main.go
binary: cluster-to-redpanda-migration
ldflags:
- -X github.com/redpanda-data/redpanda/src/go/cluster-to-redpanda-migration/cmd/version.version={{.Tag}}
env:
- CGO_ENABLED=0
goos:
- windows
- linux
goarch:
- amd64
- arm64
- id: migration-tool-darwin
dir: ./cluster-to-redpanda-migration/
main: ./main.go
binary: cluster-to-redpanda-migration
ldflags:
- -X github.com/redpanda-data/redpanda/src/go/cluster-to-redpanda-migration/cmd/version.version={{.Tag}}
env:
- CGO_ENABLED=0
goos:
- darwin
goarch:
- amd64
- arm64
hooks:
post:
- cmd: quill sign-and-notarize "{{ .Path }}" --dry-run={{ .IsSnapshot }} --ad-hoc={{ .IsSnapshot }} -vv
env:
- QUILL_LOG_FILE=dist/quill-{{ .Target }}.log
archives:
- id: rpk
builds:
- windows-and-linux
- darwin
- rpk-windows-and-linux
- rpk-darwin
format: zip
name_template: "rpk-{{ .Os }}-{{ .Arch }}"
- id: migration-tool
builds:
- migration-tool-windows-and-linux
- migration-tool-darwin
format: zip
name_template: "cluster-to-redpanda-migration-{{ .Os }}-{{ .Arch }}"
release:
github:
owner: redpanda-data
Expand All @@ -57,11 +97,13 @@ brews:
- name: redpanda
homepage: "https://redpanda.com"
description: "Redpanda CLI & toolbox"
tap:
repository:
owner: redpanda-data
name: homebrew-tap
folder: Formula
skip_upload: auto
ids:
- rpk
caveats: |
Redpanda Keeper (rpk) is Redpanda's command line interface (CLI)
utility. The rpk commands let you configure, manage, and tune
Expand Down
53 changes: 0 additions & 53 deletions src/go/cluster-to-redpanda-migration/.goreleaser.yaml

This file was deleted.

0 comments on commit c8ed0e4

Please sign in to comment.