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

chore: setup release github actions (PROJQUAY-1468) #424

Merged
merged 1 commit into from
Apr 15, 2021
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
50 changes: 50 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## Red Hat Quay Release Notes
(Red Hat Customer Portal)[https://access.redhat.com/documentation/en-us/red_hat_quay/3.5/html/red_hat_quay_release_notes/index]

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- [{{.Hash.Short}}]({{ $.Info.RepositoryURL }}/commit/{{ .Hash.Long }}): {{ .Subject }}
{{ if .Refs -}}{{ range .Refs }} - {{if .Action}}{{ .Action }}{{ end }} [#{{ .Ref }}]({{ $.Info.RepositoryURL }}/issues/{{ .Ref }}){{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}

## Historical Changelog
[CHANGELOG.md](https://github.com/quay/quay/blob/96b17b8338fb10ca2ed12e9bc920dcbba148289c/CHANGELOG.md)
30 changes: 30 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/quay/quay-operator
options:
tag_sort_by: semver
commits:
sort_by: Scope
commit_groups:
group_by: Scope
header:
pattern: '^(.*):\s*(.*)$'
pattern_maps:
- Scope
- Subject
issues:
prefix:
- "#"

refs:
actions:
- Closes
- Fixes
- PullRequest

notes:
keywords:
- BREAKING CHANGE
- NOTE
64 changes: 64 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# How to Contribute

The Quay-Operator is [Apache 2.0 licensed](LICENSE) and accepts contributions via GitHub pull requests.
This document outlines some of the conventions on development workflow, commit message formatting, contact points and other resources to make it easier to get your contribution accepted.

# Certificate of Origin

By contributing to this project you agree to the Developer Certificate of Origin [DCO](../DCO).
This document was created by the Linux Kernel community and is a simple statement that you, as a contributor, have the legal right to make the contribution.
See the [DCO](../DCO) file for details.

# Email and Chat

The project currently uses a mailing list and IRC channel:

- Issues: [PROJQUAY Jira](https://issues.redhat.com/projects/PROJQUAY/issues)
- Email: [[email protected]](https://groups.google.com/g/quay-sig)
- IRC: #[quay](irc://irc.freenode.org:6667/#quay) IRC channel on freenode.org

Please avoid emailing maintainers directly.
They are very busy and read the mailing lists.

## Getting Started

- Fork the repository on [GitHub](https://github.com/quay/quay-operator)
- Read the [README](../README.md) for build and test instructions
- Play with the project, submit bugs, submit patches!

## Contribution Flow

This is a rough outline of what a contributor's workflow looks like:

- All changes require a referenced [PROJQUAY Jira](https://issues.redhat.com/projects/PROJQUAY/issues)
- Create a topic branch from where you want to base your work (usually main).
- Make commits of logical units.
- Make sure your commit messages are in the proper format (see below).
- Push your changes to a topic branch in your fork of the repository.
- Make sure the tests pass, and add any new tests as appropriate.
- Submit a pull request to the original repository.

Thanks for your contributions!

### Format of the Commit Message

We follow a rough convention for commit messages that is designed to answer two questions: what changed and why.
The subject line should feature the what and the body of the commit should describe the why.

```
scripts: add the test-cluster command (PROJQUAY-1234)

this uses tmux to setup a test cluster that you can easily kill and
start for debugging.
```

The format can be described more formally as follows:

```
<subsystem>: <what changed> (PROJQUAY-####)
<BLANK LINE>
<why this change was made>
```

The first line is the subject and should be no longer than 70 characters, the second line is always blank, and other lines should be wrapped at 80 characters.
This allows the message to be easier to read on GitHub as well as in various git tools.
24 changes: 0 additions & 24 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,19 @@ jobs:
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Tests
run: go test -v ./...

commit-check:
name: Commit Check
runs-on: ubuntu-latest
steps:
- name: commit check
uses: gsactions/commit-message-checker@v1
with:
pattern: |
^(.*):\s*(.*)\s\(PROJQUAY-[0-9]+\)(\n.*)*$
error: 'Commit must begin with <scope>: <subject> (PROJQUAY-####)'
flags: 'gm'
excludeTitle: true
excludeDescription: true
checkAllCommitMessages: true
accessToken: ${{ secrets.GITHUB_TOKEN }}
112 changes: 112 additions & 0 deletions .github/workflows/cut-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
name: Release

on:
push:
tags:
- v3.*

jobs:
release-archive:
name: Create Release Archive
runs-on: 'ubuntu-latest'
steps:
- name: Setup
run: |
tag=`basename ${{ github.ref }}`
echo "PREFIX=quay-${tag}/" >> $GITHUB_ENV
echo "TAG=${tag}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create Release Archive
# any additional files can be added by appending to the tar
# created by `git archive`. For example:
#
# tar -rf release.tar --transform "s,^,${PREFIX}," vendor
run: |
git archive --prefix "${PREFIX}" -o release.tar "${GITHUB_REF}"
gzip release.tar
- name: ChangeLog
shell: bash
run: |
curl -o /tmp/git-chglog.tar.gz -fsSL\
https://github.com/git-chglog/git-chglog/releases/download/v0.14.0/git-chglog_0.14.0_linux_amd64.tar.gz
tar xvf /tmp/git-chglog.tar.gz --directory /tmp
chmod u+x /tmp/git-chglog
echo "creating change log for tag: $TAG"
/tmp/git-chglog --tag-filter-pattern "v3.*" -o changelog v3.6.0-alpha.4..
- name: Upload Release Archive
uses: actions/upload-artifact@v2
with:
name: release
path: |
release.tar.gz
changelog
if-no-files-found: error

release:
name: Release
runs-on: 'ubuntu-latest'
if: github.event_name == 'push'
needs: [release-archive]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Setup
run: |
tag=`basename ${{ github.ref }}`
echo "VERSION=${tag}" >> $GITHUB_ENV
- name: Fetch Artifacts
uses: actions/download-artifact@v2
id: download
with:
name: release
- name: Create Release
uses: actions/create-release@latest
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ env.VERSION }} Release
body_path: ${{steps.download.outputs.download-path}}/changelog
prerelease: ${{ contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') || contains(env.VERSION, 'rc') }}
- name: Publish Release Archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{steps.download.outputs.download-path}}/release.tar.gz
asset_name: quay-${{ env.VERSION }}.tar.gz
asset_content_type: application/gzip

publish-container:
name: Publish Container
runs-on: 'ubuntu-latest'
needs: [release-archive, release]
steps:
- name: Setup
run: |
tag=`basename ${{ github.ref }}`
echo "QUAY_VERSION=${tag}" >> $GITHUB_ENV
echo "TAG=quay.io/projectquay/quay-operator:${tag}" >> $GITHUB_ENV
echo "QUAY_USER=projectquay+quay_github" >> $GITHUB_ENV
echo "::add-mask::${{ secrets.QUAY_TOKEN }}"
- name: Fetch Artifacts
uses: actions/download-artifact@v2
id: download
with:
name: release
- name: Build Release Container
run: |
d=$(mktemp -d)
trap 'rm -rf "$d"' EXIT
tar -xz -f ${{steps.download.outputs.download-path}}/release.tar.gz --strip-components=1 -C "$d"
docker build --build-arg QUAY_VERSION --tag "${TAG}" "$d"
- name: Publish Release Container
run: |
docker login -u "${QUAY_USER}" -p '${{ secrets.QUAY_TOKEN }}' quay.io
docker push "${TAG}"
44 changes: 44 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Prepare Release

on:
workflow_dispatch:
inputs:
branch:
description: 'the branch to prepare the release against'
required: true
default: 'master'
tag:
description: 'the tag to be released'
rdequired: true
jira:
description: 'PROJQUAY jira release issue'
required: true

jobs:
prepare:
name: Prepare Release
runs-on: 'ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- name: Changelog
run: |
curl -o /tmp/git-chglog.tar.gz -fsSL\
https://github.com/git-chglog/git-chglog/releases/download/v0.14.0/git-chglog_0.14.0_linux_amd64.tar.gz
tar xvf /tmp/git-chglog.tar.gz --directory /tmp
chmod u+x /tmp/git-chglog
echo "creating change log for tag: ${{ github.event.inputs.tag }}"
/tmp/git-chglog --tag-filter-pattern "v3.*" -o CHANGELOG.md v3.6.0-alpha.4..
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
title: "${{ github.event.inputs.tag }} Changelog Bump"
body: "This is an automated changelog commit."
commit-message: "chore: ${{ github.event.inputs.tag }} changelog bump (${{ github.event.inputs.jira }})"
branch: "ready-${{ github.event.inputs.tag }}"
signoff: true
delete-branch: true
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
empty