Skip to content

Commit 17c007b

Browse files
authored
Create Release PR workflow (#1732)
Problem: Manually updating the old tag is boring and error prone Solution: Automate the process and automatically open a PR for the release
1 parent 45a4085 commit 17c007b

File tree

4 files changed

+138
-31
lines changed

4 files changed

+138
-31
lines changed

.github/CHANGELOG_TEMPLATE.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Release %%VERSION%%
2+
3+
%%DATE%%
4+
5+
FEATURES:
6+
7+
-
8+
9+
BUG FIXES:
10+
11+
-
12+
13+
DOCUMENTATION:
14+
15+
-
16+
17+
HELM CHART:
18+
19+
- The version of the Helm chart is now %%VERSION%%
20+
-
21+
22+
UPGRADE:
23+
24+
-
25+
26+
COMPATIBILITY:
27+
28+
- The Gateway API version: ``
29+
- NGINX version: ``
30+
- Kubernetes version: ``
31+
32+
CONTAINER IMAGES:
33+
34+
- Control plane: `ghcr.io/nginxinc/nginx-gateway-fabric:%%VERSION%%`
35+
- Data plane: `ghcr.io/nginxinc/nginx-gateway-fabric/nginx:%%VERSION%%`
36+
- Data plane with NGINX Plus: `private-registry.nginx.com/nginx-gateway-fabric/nginx-plus:%%VERSION%%`

.github/workflows/nfr.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ jobs:
4646
steps:
4747
- name: Checkout Repository
4848
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
49-
with:
50-
token: ${{ secrets.NGINX_PAT }}
5149

5250
- name: Setup Golang Environment
5351
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
@@ -165,6 +163,7 @@ jobs:
165163
token: ${{ secrets.NGINX_PAT }}
166164
commit-message: NFR Test Results for NGF version ${{ inputs.version }} ${{ inputs.nginx_plus == true && '(Plus)' || ''}}
167165
author: nginx-bot <[email protected]>
166+
committer: nginx-bot <[email protected]>
168167
branch: tests/nfr-tests-${{ inputs.version }}${{ inputs.nginx_plus == true && '-plus' || ''}}
169168
delete-branch: true
170169
title: NFR Test Results for NGF version ${{ inputs.version }} ${{ inputs.nginx_plus == true && '(Plus)' || ''}}

.github/workflows/release-pr.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to release"
8+
required: true
9+
default: "0.0.0"
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-22.04
18+
steps:
19+
- name: Branch
20+
id: branch
21+
run: |
22+
version=${{ github.event.inputs.version }}
23+
version=${version%.*}
24+
echo "branch=release-$version" >> $GITHUB_OUTPUT
25+
26+
- name: Checkout Repository
27+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28+
with:
29+
ref: ${{ steps.branch.outputs.branch }}
30+
31+
- name: Vars
32+
id: vars
33+
run: |
34+
# TODO(lucacome): improve this and maybe use appVersion instead of version if we switch to tags
35+
echo "current_version=$(yq '.version' <deploy/helm-chart/Chart.yaml)" >> $GITHUB_OUTPUT
36+
37+
- name: Find and Replace
38+
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2
39+
with:
40+
find: ${{ steps.vars.outputs.current_version }}
41+
replace: ${{ inputs.version }}
42+
include: "site/content/**/*.md"
43+
regex: false
44+
45+
- name: Find and Replace
46+
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2
47+
with:
48+
find: "edge"
49+
replace: ${{ inputs.version }}
50+
include: "deploy/helm-chart/*.yaml"
51+
regex: false
52+
53+
- name: Find and Replace
54+
uses: jacobtomlinson/gha-find-replace@a51bbcd94d000df9ca0fcb54ec8be69aad8374b0 # v3.0.2
55+
with:
56+
find: "Always"
57+
replace: "IfNotPresent"
58+
include: "deploy/helm-chart/*.yaml"
59+
regex: false
60+
61+
- name: Generate manifests and changelog
62+
run: |
63+
sed -i -e "s/v${{ steps.vars.outputs.current_version }}/v${{ inputs.version }}/g" README.md
64+
sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" Makefile
65+
sed -i -e "s/VERSION = ${{ steps.vars.outputs.current_version }}/VERSION = ${{ inputs.version }}/g" conformance/Makefile
66+
sed -i -e "s/TAG = edge/TAG = ${{ inputs.version }}/g" **/Makefile
67+
sed -i "5r .github/CHANGELOG_TEMPLATE.md" CHANGELOG.md
68+
sed -i -e "s/%%VERSION%%/${{ inputs.version }}/g" CHANGELOG.md
69+
make generate-manifests
70+
71+
- name: Create Pull Request
72+
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2
73+
with:
74+
token: ${{ secrets.NGINX_PAT }}
75+
commit-message: Release ${{ inputs.version }}
76+
title: Release ${{ inputs.version }}
77+
branch: docs/release-${{ inputs.version }}
78+
author: nginx-bot <[email protected]>
79+
committer: nginx-bot <[email protected]>
80+
body: |
81+
This automated PR updates all the necessary files for ${{ inputs.version }} release.

docs/developer/release-process.md

+20-29
Original file line numberDiff line numberDiff line change
@@ -30,36 +30,27 @@ To create a new release, follow these steps:
3030
3. Test the main branch for release-readiness. For that, use the `edge` containers, which are built from the main
3131
branch, and run the following:
3232
1. Run the [example applications](/examples) manually and verify their correctness.
33-
2. Kick off the [NFR workflow](https://github.com./nginxinc/nginx-gateway-fabric/actions/nfr.yml) in the browser. For `image_tag`, use `edge`, and for `version`, use the upcoming `X.Y.Z` NGF version. This will run all of the NFR tests which are automated and open a PR with the results files when it is complete. Review this PR and make any necessary changes before merging.
33+
2. Kick off the [NFR workflow](https://github.com./nginxinc/nginx-gateway-fabric/actions/nfr.yml) in the browser. For `image_tag`, use `edge`, and for `version`, use the upcoming `X.Y.Z` NGF version. This will run all of the NFR tests which are automated and open a PR with the results files when it is complete. Review this PR and make any necessary changes before merging.
3434
4. If a problem is found, prepare a fix PR, merge it into the main branch and return to the previous step.
3535
5. If the supported Gateway API minor version has changed since the last release, test NGINX Gateway Fabric with the previous version of the Gateway API CRDs.
3636
6. If a compatibility issue is found, add a note to the release notes explaining that the previous version is not supported.
3737
7. Create a release branch following the `release-X.Y` naming convention.
38-
8. Prepare and merge a PR into the **release branch** to update the repo files for the release:
39-
1. Update the Helm [Chart.yaml](/deploy/helm-chart/Chart.yaml): the `appVersion` to `X.Y.Z`, the icon and source
40-
URLs to point at `vX.Y.Z`, and bump the `version`.
41-
2. Adjust the `VERSION` variable in the [Makefile](/Makefile) and the `TAG` in the
42-
[conformance tests Makefile](/conformance/Makefile) to `X.Y.Z`.
43-
3. Update the tag of NGF container images used in the Helm [values.yaml](/deploy/helm-chart/values.yaml) file,
44-
the [provisioner manifest](/conformance/provisioner/provisioner.yaml), and all docs to `X.Y.Z`.
45-
4. Ensure that the `imagePullPolicy` is `IfNotPresent` in the Helm [values.yaml](/deploy/helm-chart/values.yaml)
46-
file.
47-
5. Generate the installation manifests by running `make generate-manifests`.
48-
6. Modify any `git clone` instructions to use `vX.Y.Z` tag.
49-
7. Modify any docs links that refer to `main` to instead refer to `vX.Y.Z` or `release-x-y`, whichever is applicable.
50-
8. Update any installation instructions to ensure that the supported Gateway API and NGF versions are correct.
51-
Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`.
52-
9. Update the [README](/README.md) to include information about the release.
53-
10. Update the [changelog](/CHANGELOG.md). The changelog includes only important (from the user perspective)
54-
changes to NGF. This is in contrast with the autogenerated full changelog, which is created in the next
55-
step. As a starting point, copy the important features, bug fixes, and dependencies from the autogenerated
56-
draft of the full changelog. This draft can be found under
57-
the [GitHub releases](https://github.com./nginxinc/nginx-gateway-fabric/releases) after the release branch is
58-
created. Use the previous changelog entries for formatting and content guidance.
38+
8. Run the [Release PR](./../../.github/workflows/release-pr.yml) workflow to update the repo files for the release. Then there are a few manual steps to complete:
39+
1. Update the tag of NGF container images used in the [provisioner manifest](/conformance/provisioner/provisioner.yaml).
40+
2. Update any installation instructions to ensure that the supported Gateway API is correct.
41+
Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`.
42+
3. Update the [README](/README.md) to include information about the release.
43+
4. Update the [changelog](/CHANGELOG.md). There is going to be a new blank section generated by the automation that needs to be adjusted accordingly.
44+
The changelog includes only important (from the user perspective)
45+
changes to NGF. This is in contrast with the autogenerated full changelog, which is created in the next
46+
step. As a starting point, copy the important features, bug fixes, and dependencies from the autogenerated
47+
draft of the full changelog. This draft can be found under
48+
the [GitHub releases](https://github.com./nginxinc/nginx-gateway-fabric/releases) after the release branch is
49+
created.
5950
9. Create and push the release tag in the format `vX.Y.Z`. As a result, the CI/CD pipeline will:
60-
- Build NGF, NGINX and NGINX Plus container images with the release tag `X.Y.Z` and push them to the registries.
61-
- Package and publish the Helm chart to the registry.
62-
- Create a GitHub release with an autogenerated changelog and attached release artifacts.
51+
- Build NGF, NGINX and NGINX Plus container images with the release tag `X.Y.Z` and push them to the registries.
52+
- Package and publish the Helm chart to the registry.
53+
- Create a GitHub release with an autogenerated changelog and attached release artifacts.
6354
10. Prepare and merge a PR into the main branch to update the [README](/README.md) to include the information about
6455
the latest release and also the [changelog](/CHANGELOG.md). Also update any installation instructions to ensure
6556
that the supported Gateway API and NGF versions are correct. Specifically, helm README and `site/content/includes/installation/install-gateway-api-resources.md`.
@@ -70,9 +61,9 @@ To create a new release, follow these steps:
7061
15. Submit the `conformance-profile.yaml` artifact from the release to the [Gateway API repo](https://github.com./kubernetes-sigs/gateway-api/tree/main/conformance/reports).
7162
- Create a fork of the repository
7263
- Name the file `nginxinc-nginx-gateway-fabric.yaml` and set `gatewayAPIVersion` in the file to the
73-
supported version by NGF. Also update the site source if necessary (see following example).
64+
supported version by NGF. Also update the site source if necessary (see following example).
7465
- Open a PR. [Example](https://github.com./kubernetes-sigs/gateway-api/pull/2514)
75-
If it's your first time submitting a PR, you will need to sign a CLA using F5, Inc. as the organization.
66+
If it's your first time submitting a PR, you will need to sign a CLA using F5, Inc. as the organization.
7667

7768
### Patch Release
7869

@@ -83,8 +74,8 @@ To create a new release, follow these steps:
8374
1. Create an issue to define and track release-related activities. Choose a title that follows the
8475
format `Release X.Y.Z`.
8576
2. If the fix applies to both the latest release and the main branch, then:
86-
1. Prepare and merge a fix PR into the in the main branch.
87-
2. Prepare and merge a fix PR (with a cherry-pick commit) into the existing release branch.
77+
1. Prepare and merge a fix PR into the in the main branch.
78+
2. Prepare and merge a fix PR (with a cherry-pick commit) into the existing release branch.
8879
3. Alternatively, if the fix only applies to the latest release, prepare and merge a fix PR into the existing release
8980
branch.
9081
4. Test the release branch for release-readiness.

0 commit comments

Comments
 (0)