Skip to content

Commit 02fcf00

Browse files
committed
docs: Add how to release doc
1 parent c23c2d5 commit 02fcf00

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed

devbox.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"path:./hack/flakes#go-mod-upgrade",
3636
"path:./hack/flakes#golangci-lint",
3737
"path:./hack/flakes#goprintconst",
38+
"path:./hack/flakes#release-please",
3839
"path:./hack/flakes#setup-envtest"
3940
],
4041
"shell": {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
+++
2+
title = "Releasing"
3+
+++
4+
5+
This project uses [release-please] to automate changelog updates per release. Due to security restrictions[^1] in the
6+
`nutanix-cloud-native` GitHub organization, the release process is a little more complex than just using the
7+
[release-please-action].
8+
9+
When a release has been cut, a new release PR can be created manually using the `release-please` CLI locally. This needs
10+
to be run by someone with write permissions to the repository. Create the `release-please` branch and PR:
11+
12+
```bash
13+
make release-please
14+
```
15+
16+
This will create the branch and release PR. From this point on until a release is ready, the `release-please-action`
17+
will keep the PR up to date (GHA workflows are only not allowed to create the original PR, they can keep the PR up to
18+
date).
19+
20+
When a release is ready, the commits in the release PR will need to be signed (again, this is a security requirement).
21+
To do this, check out the PR branch locally:
22+
23+
```bash
24+
gh pr checkout <RELEASE_PR_NUMBER>
25+
```
26+
27+
Sign the previous commit:
28+
29+
```bash
30+
git commit --gpg-sign --amend
31+
```
32+
33+
And force push:
34+
35+
```bash
36+
git push --force-with-lease
37+
```
38+
39+
The PR will then need the standard 2 reviewers and will then be auto-merged, triggering the release jobs to run and push
40+
relevant artifacts and images.
41+
42+
[^1]: Specifically, GitHub Actions workflows are not allowed to create or approve PRs due to a potential security flaw.
43+
See [this blog post][cider-sec] for more details, as well as the [Security Hardening for GitHub Actions
44+
docs][gha-security-hardening].
45+
46+
[release-please]: https://github.com/googleapis/release-please/
47+
[release-please-action]: https://github.com/google-github-actions/release-please-action
48+
[cider-sec]: https://medium.com/cider-sec/bypassing-required-reviews-using-github-actions-6e1b29135cc7
49+
[gha-security-hardening]: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions

hack/flakes/flake.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@
8181
"-X" "sigs.k8s.io/cluster-api-provider-aws/v2/version.gitTreeState=clean"
8282
];
8383
};
84+
85+
release-please = buildNpmPackage rec {
86+
pname = "release-please";
87+
version = "16.10.2";
88+
src = fetchFromGitHub {
89+
owner = "googleapis";
90+
repo = "release-please";
91+
rev = "v${version}";
92+
hash = "sha256-5EST9dNB59wZ9NSHx7V8pAZsws0Py3Q73R6MxvS7zFA=";
93+
};
94+
npmDepsHash = "sha256-HZAjBF4dH8JTgJrDrXtxJLyAfKKGn9P5fGBSILx00b8=";
95+
dontNpmBuild = true;
96+
};
8497
};
8598

8699
formatter = alejandra;

make/dev.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ dev.update-bootstrap-credentials-aws:
3737
kubectl patch secret capa-manager-bootstrap-credentials -n capa-system -p="{\"data\":{\"credentials\": \"$$(clusterawsadm bootstrap credentials encode-as-profile)\"}}"
3838
kubectl rollout restart deployment capa-controller-manager -n capa-system
3939
kubectl rollout status deployment capa-controller-manager -n capa-system
40+
41+
.PHONY: release-please
42+
release-please:
43+
ifneq ($(GIT_CURRENT_BRANCH),main)
44+
$(error "release-please should only be run on the main branch")
45+
else
46+
release-please release-pr \
47+
--repo-url $(GITHUB_ORG)/$(GITHUB_REPOSITORY) --token "$$(gh auth token)"
48+
endif

0 commit comments

Comments
 (0)