From fcd8aef12ae3bdbf36b1a663e5a0e544c37385fb Mon Sep 17 00:00:00 2001 From: Daniel Chavero Date: Fri, 30 Jun 2023 17:43:35 +0200 Subject: [PATCH] Add GitHub workflow to generate release (#48) * add goreleaser to automate release with git tags * add templates for new issues * fix go version required * fix badge url * fix goreleaser gh action config * fix goreleaser to check only major and minor go version --- .github/ISSUE_TEMPLATE/bug_report.md | 46 ++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 +++++++ .github/workflows/releases.yaml | 30 ++++++++++ .goreleaser.yml | 67 +++++++++++++++++++++++ README.md | 2 + 5 files changed, 165 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/releases.yaml create mode 100644 .goreleaser.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..bcd41b6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,46 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: community, triage +assignees: '' + +--- + + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. +4. + +## Context + + + +## Regression + + + +## Your Environment + +* Version used (`cluster-relocation-operator`): +* Environment name and version (e.g. OCP v1.12.20): +* Server type and version: +* Operating System and version (`uname -a`): +* Link to your deployment file: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..4a7b218 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: community, triage +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/releases.yaml b/.github/workflows/releases.yaml new file mode 100644 index 0000000..6ffdf45 --- /dev/null +++ b/.github/workflows/releases.yaml @@ -0,0 +1,30 @@ +name: Go Releaser + +on: + push: + tags: + - 'v*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: "go.mod" + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..2440c24 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,67 @@ +# Global environment variables for builds. +env: + - CGO_ENABLED=0 + - GO111MODULE=on + - GOPROXY=https://proxy.golang.org|direct + - REPO=github.com/danielchg/cluster-relocation-operator + +# Hooks to run before any build is run. +before: + hooks: + - go version | grep --quiet "go1\.19" || echo "Go binary version must be 1.19" + - go mod download + +# Binary builds. +builds: + # cluster-relocation-operator build steps + - id: cluster-relocation-operator + main: ./ + binary: cluster-relocation-operator + mod_timestamp: "{{ .CommitTimestamp }}" + # asmflags: &build-asmflags + # - all=-trimpath={{ .Env.PWD }} + # gcflags: &build-gcflags + # - all=-trimpath={{ .Env.PWD }} + # ldflags: &build-ldflags + # - -X {{ .Env.REPO }}/internal/version.Version={{ .Env.SIMPLE_VERSION }} + # - -X {{ .Env.REPO }}/internal/version.GitVersion={{ .Env.GIT_VERSION }} + # - -X {{ .Env.REPO }}/internal/version.GitCommit={{ .Env.GIT_COMMIT }} + # - -X {{ .Env.REPO }}/internal/version.KubernetesVersion={{ .Env.K8S_VERSION }} + # - -X {{ .Env.REPO }}/internal/version.ImageVersion={{ .Env.IMAGE_VERSION }} + targets: &build-targets + - linux_amd64 + - linux_arm64 + +# Use most recent tag and short commit for snapshot version. +snapshot: + name_template: "{{ .Env.GIT_VERSION }}" + +# We don't use archives, so skip creating them. +archives: + - format: binary + name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}" + +checksum: + name_template: "checksums.txt" + +# Sign the checksum file with the CI GPG key. +# signs: +# - signature: "${artifact}.asc" +# artifacts: checksum +# # Use the CI signing subkey A20B5C7E decrypted into .ci/gpg/keyring to sign the release. +# args: ["--home", ".ci/gpg/keyring", "-u", "A20B5C7E", "--output", "${signature}", "--detach-sign", "${artifact}"] + +# We use a custom changelog generator. +# changelog: + +# TODO(estroz): configure homebrew publishing +# brews: +# - name: operator-sdk +# ids: +# - operator-sdk + +# Uncomment for testing +# release: +# github: +# owner: +# name: operator-sdk \ No newline at end of file diff --git a/README.md b/README.md index 9c6fced..f61b4df 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # cluster-relocation-operator +![CI Status](https://github.com/RHsyseng/cluster-relocation-operator/actions/workflows/operator.yaml/badge.svg) + :warning: **This is a community project, it is not supported by Red Hat in any way.** :warning: ## Description