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

Automate release via Github Action #1624

Merged
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
6 changes: 4 additions & 2 deletions .github/workflows/cover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: "bash hack/install-go.sh"
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.17'
- run: "PATH=/usr/local/go/bin:$PATH make test-cover"
- uses: codecov/codecov-action@v1
with:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: release

jobs:
build:
name: tag release
runs-on: ubuntu-latest
steps:
- name: Set env
run: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install go
uses: actions/setup-go@v2
CecileRobertMichon marked this conversation as resolved.
Show resolved Hide resolved
with:
go-version: '^1.17'
- name: generate release artifacts
run: |
make release
- name: generate release notes
run: |
make release-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: out/*
body_path: release-notes-${{ env.RELEASE_TAG }}.md
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,11 @@ set-manifest-pull-policy:
## Release
## --------------------------------------

RELEASE_TAG := $(shell git describe --abbrev=0 2>/dev/null)
RELEASE_DIR := out
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
PREVIOUS_TAG ?= $(shell git describe --abbrev=0 $(RELEASE_TAG)^ 2>/dev/null)
RELEASE_DIR ?= out
GIT_REPO_NAME ?= cluster-api-provider-azure
GIT_ORG_NAME ?= kubernetes-sigs

$(RELEASE_DIR):
mkdir -p $(RELEASE_DIR)/
Expand Down Expand Up @@ -460,7 +463,7 @@ release-alias-tag: # Adds the tag to the last build tag.

.PHONY: release-notes
release-notes: $(RELEASE_NOTES)
$(RELEASE_NOTES)
$(RELEASE_NOTES) --org $(GIT_ORG_NAME) --repo $(GIT_REPO_NAME) --start-rev $(PREVIOUS_TAG) --end-rev $(RELEASE_TAG) --output release-notes-$(RELEASE_TAG).md

## --------------------------------------
## Development
Expand Down
70 changes: 31 additions & 39 deletions docs/book/src/developers/releasing.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,47 @@
# Release Process

## Change milestone
- Create a new GitHub milestone for the next release
- Change milestone applier so new changes can be applied to the appropriate release
- Open a PR in https://github.com/kubernetes/test-infra to change this [line](https://github.com/kubernetes/test-infra/blob/25db54eb9d52e08c16b3601726d8f154f8741025/config/prow/plugins.yaml#L344)
- Example PR: https://github.com/kubernetes/test-infra/pull/16827

## Prepare branch, tag and release notes
- Identify a known good commit on the main branch
- Fast-forward the release branch to the selected commit. :warning: Always release from the release branch and not from main!
- `git checkout release-0.x`
- `git fetch upstream`
- `git merge --ff-only upstream/main`
- `git push`
- Create tag with git
- `export RELEASE_TAG=v0.4.6` (the tag of the release to be cut)
- `git tag -s ${RELEASE_TAG} -m "${RELEASE_TAG}"`
- `-s` creates a signed tag, you must have a GPG key [added to your GitHub account](https://docs.github.com/en/enterprise/2.16/user/github/authenticating-to-github/generating-a-new-gpg-key)
- `git push upstream ${RELEASE_TAG}`
- Update the file `metadata.yaml` if is a major or minor release
- `make release` from repo, this will create the release artifacts in the `out/` folder
- Install the `release-notes` tool according to [instructions](https://github.com/kubernetes/release/blob/master/cmd/release-notes/README.md)
- Export GITHUB_TOKEN
- Run the release-notes tool with the appropriate commits. Commits range from the first commit after the previous release to the new release commit.
```
release-notes --github-org kubernetes-sigs --github-repo cluster-api-provider-azure \
--start-sha 1cf1ec4a1effd9340fe7370ab45b173a4979dc8f \
--end-sha e843409f896981185ca31d6b4a4c939f27d975de
```
- Manually format and categorize the release notes

- Create a new GitHub milestone for the next release
- Change milestone applier so new changes can be applied to the appropriate release
- Open a PR in https://github.com/kubernetes/test-infra to change this [line](https://github.com/kubernetes/test-infra/blob/25db54eb9d52e08c16b3601726d8f154f8741025/config/prow/plugins.yaml#L344)
- Example PR: https://github.com/kubernetes/test-infra/pull/16827

## Create a tag

- Identify a known good commit on the main branch
- Fast-forward the release branch to the selected commit. :warning: Always release from the release branch and not from main!
- `git checkout release-0.x`
- `git fetch upstream`
- `git merge --ff-only upstream/main`
- `git push`
- Create tag with git
- `export RELEASE_TAG=v0.4.6` (the tag of the release to be cut)
- `git tag -s ${RELEASE_TAG} -m "${RELEASE_TAG}"`
- `-s` creates a signed tag, you must have a GPG key [added to your GitHub account](https://docs.github.com/en/enterprise/2.16/user/github/authenticating-to-github/generating-a-new-gpg-key)
- `git push upstream ${RELEASE_TAG}`

This will automatically trigger a [Github Action](https://github.com/kubernetes-sigs/cluster-api-provider-azure/actions) to create a draft release.

## Promote image to prod repo
Promote image
- Images are built by the [post push images job](https://testgrid.k8s.io/sig-cluster-lifecycle-cluster-api-provider-azure#post-cluster-api-provider-azure-push-images)
- Create a PR in https://github.com/kubernetes/k8s.io to add the image and tag
- Example PR: https://github.com/kubernetes/k8s.io/pull/1030/files
- Location of image: https://console.cloud.google.com/gcr/images/k8s-staging-cluster-api-azure/GLOBAL/cluster-api-azure-controller?rImageListsize=30

- Images are built by the [post push images job](https://testgrid.k8s.io/sig-cluster-lifecycle-cluster-api-provider-azure#post-cluster-api-provider-azure-push-images)
- Create a PR in https://github.com/kubernetes/k8s.io to add the image and tag
- Example PR: https://github.com/kubernetes/k8s.io/pull/1030/files
- Location of image: https://console.cloud.google.com/gcr/images/k8s-staging-cluster-api-azure/GLOBAL/cluster-api-azure-controller?rImageListsize=30

## Release in GitHub
Create the GitHub release in the UI
- Create a draft release in GitHub and associate it with the tag that was created
- Copy paste the release notes
- Upload [artifacts](#expected-artifacts) from the `out/` folder
- Publish release
- [Announce][release-announcement] the release

- Manually format and categorize the release notes
- Publish release
- [Announce][release-announcement] the release

## Versioning

cluster-api-provider-azure follows the [semantic versionining][semver] specification.

Example versions:

- Pre-release: `v0.1.1-alpha.1`
- Minor release: `v0.1.0`
- Patch release: `v0.1.1`
Expand Down
39 changes: 0 additions & 39 deletions hack/install-go.sh

This file was deleted.