Skip to content

Commit

Permalink
Add GitHub workflow to generate release (#48)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
danielchg authored Jun 30, 2023
1 parent 0ed49a1 commit fcd8aef
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: community, triage
assignees: ''

---

<!--- Provide a general summary of the issue in the Title above -->

## Expected Behavior
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Regression
<!-- Is this issue a regression? (Yes / No) -->
<!-- If Yes, optionally please include minio-operator version caused the regression, if you have these details. -->

## Your Environment
<!--- Include as many relevant details about the environment you experienced the bug in -->
* 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:
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -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.
30 changes: 30 additions & 0 deletions .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
67 changes: 67 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -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: <your-github-namespace>
# name: operator-sdk
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit fcd8aef

Please sign in to comment.