Skip to content

Commit bd7f001

Browse files
authored
Merge pull request #5239 from koba1t/chore/change_release_flow
change release flow from using goreleaser to build scripts
2 parents d6ff768 + b1717c8 commit bd7f001

File tree

8 files changed

+178
-365
lines changed

8 files changed

+178
-365
lines changed

.github/workflows/release.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- kyaml/v*
7+
- cmd/config/v*
8+
- api/v*
9+
- kustomize/v*
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out code into the Go module directory
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Set up Go 1.x
20+
uses: actions/setup-go@v3
21+
with:
22+
go-version-file: go.work
23+
id: go
24+
- run: ./releasing/create-release.sh "${tag}"
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
tag: ${{ github.ref_name }}

releasing/README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# Releasing
22

33
[release page]: /../../releases
4-
[`cloud-build-local`]: https://github.com/GoogleCloudPlatform/cloud-build-local
4+
[GitHub Actions]: /../../actions
55
[Google Cloud Build]: https://cloud.google.com/cloud-build
66
[semver]: https://semver.org
77
[Go modules]: https://github.com/golang/go/wiki/Modules
88
[multi-module repo]: https://github.com/go-modules-by-example/index/blob/master/009_submodules/README.md
99
[semver review]: #semver-review
1010
[semver release]: #semver-review
11-
[`cloudbuild.yaml`]: cloudbuild.yaml
11+
[`cloudbuild_kustomize_image.yaml`]: cloudbuild_kustomize_image.yaml
12+
[`release.yaml`]: ../.github/workflows/release.yaml
13+
[`create-release.sh`]: create-release.sh
1214
[kustomize repo release page]: https://github.com/kubernetes-sigs/kustomize/releases
1315
[OpenAPI Readme]: ../kyaml/openapi/README.md
14-
[project cloud build history page]: https://console.cloud.google.com/cloud-build/builds?project=k8s-staging-kustomize
16+
[the build status for container image]: https://console.cloud.google.com/cloud-build/builds?project=k8s-staging-kustomize
17+
[build history of GitHub Actions job]: /../../actions
1518

1619
This document describes how to perform a [semver release]
1720
of one of the several [Go modules] in this repository.
@@ -23,11 +26,10 @@ branch is also created as necessary to track patch releases.
2326
A properly formatted tag (described below) contains
2427
the module name and version.
2528

26-
Pushing the tag upstream will trigger [Google Cloud Build] to build a release
27-
and make it available on the [release page].
29+
Pushing the tag upstream will trigger [GitHub Actions] to build a release and make it available on the [release page].
30+
[GitHub Actions] reads its instructions from the [`release.yaml`] file in `.github/workflows` directory.
2831

29-
Cloud build reads its instructions from the
30-
[`cloudbuild.yaml`] file in this directory.
32+
And, container image contains `kustomize` binary will build [Google Cloud Build] that instructions from [`cloudbuild_kustomize_image.yaml`] file triggered by tags contain `kustomize` and release versions.
3133

3234
We use a Go program to make the tagging and branch
3335
creation process less error prone.
@@ -123,7 +125,7 @@ testKustomizeRepo
123125
While you're waiting for the tests, review the commit log:
124126

125127
```
126-
releasing/compile-changelog.sh kyaml HEAD
128+
releasing/compile-changelog.sh kyaml HEAD
127129
```
128130

129131
Based on the changes to be included in this release, decide whether a patch, minor or major version bump is needed: [semver review].
@@ -144,8 +146,7 @@ Note the version:
144146
versionKyaml=v0.10.20 # EDIT THIS!
145147
```
146148

147-
See the process of the cloud build job
148-
on the [project cloud build history page].
149+
See the process of the [build history of GitHub Actions job].
149150

150151
Undraft the release on the [kustomize repo release page]:
151152
* Make sure the version number is what you expect.
@@ -180,7 +181,7 @@ testKustomizeRepo
180181
While you're waiting for the tests, review the commit log:
181182

182183
```
183-
releasing/compile-changelog.sh cmd/config HEAD
184+
releasing/compile-changelog.sh cmd/config HEAD
184185
```
185186

186187
Based on the changes to be included in this release, decide whether a patch, minor or major version bump is needed: [semver review].
@@ -196,8 +197,7 @@ Note the version:
196197
versionCmdConfig=v0.9.12 # EDIT THIS!
197198
```
198199

199-
See the process of the cloud build job
200-
on the [project cloud build history page].
200+
See the process of the [build history of GitHub Actions job].
201201

202202
Undraft the release on the [kustomize repo release page]:
203203
* Make sure the version number is what you expect.
@@ -233,7 +233,7 @@ testKustomizeRepo
233233
While you're waiting for the tests, review the commit log:
234234

235235
```
236-
releasing/compile-changelog.sh api HEAD
236+
releasing/compile-changelog.sh api HEAD
237237
```
238238

239239
Based on the changes to be included in this release, decide whether a patch, minor or major version bump is needed: [semver review].
@@ -249,8 +249,7 @@ Note the version:
249249
versionApi=v0.8.10 # EDIT THIS!
250250
```
251251

252-
See the process of the cloud build job
253-
on the [project cloud build history page].
252+
See the process of the [build history of GitHub Actions job].
254253

255254
Undraft the release on the [kustomize repo release page]:
256255
* Make sure the version number is what you expect.
@@ -291,7 +290,7 @@ testKustomizeRepo
291290
While you're waiting for the tests, review the commit log:
292291

293292
```
294-
releasing/compile-changelog.sh kustomize HEAD
293+
releasing/compile-changelog.sh kustomize HEAD
295294
```
296295

297296
Based on the changes to be included in this release, decide whether a patch, minor or major version bump is needed: [semver review].
@@ -302,8 +301,9 @@ Based on the changes to be included in this release, decide whether a patch, min
302301
gorepomod release kustomize [patch|minor|major] --doIt
303302
```
304303

305-
See the process of the cloud build job
306-
on the [project cloud build history page].
304+
See the process of the [build history of GitHub Actions job].
305+
306+
And check the process of [the build status for container image].
307307

308308
Undraft the release on the [kustomize repo release page]:
309309
* Make sure the version number is what you expect.
@@ -366,8 +366,7 @@ Checkout a new branch.
366366
Edit file `registry.k8s.io/images/k8s-staging-kustomize/images.yaml`
367367
to add the new kustomize version and the image sha256.
368368

369-
Image sha256 can be found in the image registry in the GCP
370-
project [k8s-staging-kustomize].
369+
Image sha256 can be found in the image registry in the GCP project [k8s-staging-kustomize].
371370

372371
Commit and push your changes. Then create a PR to [k8s.io] to promote
373372
the new image.
@@ -400,4 +399,5 @@ https://github.com/kubernetes/kubernetes/pull/106389
400399

401400
# Testing changes to the release pipeline
402401

403-
You can test the release script locally by running [cloudbuild.sh](cloudbuild.sh) in a container or by installing Cloud Build Local and running [cloudbuild-local.sh](cloudbuild-local.sh). See each of those files for more details on their usage.
402+
You can test the release script locally by running [`create-release.sh`].
403+
See each of those files for more details on their usage.

releasing/cloudbuild-local.sh

Lines changed: 0 additions & 57 deletions
This file was deleted.

releasing/cloudbuild.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

releasing/cloudbuild.yaml

Lines changed: 0 additions & 71 deletions
This file was deleted.

releasing/compile-changelog.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@ if [[ -z "${1-}" ]] || [[ -z "${2-}" ]]; then
2727
exit 1
2828
fi
2929

30-
if [[ -z "${GITHUB_USERNAME-}" ]] || [[ -z "${GITHUB_TOKEN-}" ]]; then
31-
echo "WARNING: Please set GITHUB_USERNAME and GITHUB_TOKEN to avoid GitHub API rate limits."
32-
github_auth_string=""
33-
else
34-
github_auth_string="-u ${GITHUB_USERNAME}:${GITHUB_TOKEN}"
35-
fi
36-
3730
module=$1
3831
fullTag=$2
3932
changeLogFile="${3:-}"
@@ -57,12 +50,21 @@ for((i=0; i < ${#commits[@]}; i+=batchSize))
5750
do
5851
commitList=$(IFS="+"; echo "${commits[@]:i:batchSize}" | sed 's/ /+/g')
5952

60-
if ! newResultsRaw=$(curl -sSL "https://api.github.com/search/issues?q=$commitList+repo%3Akubernetes-sigs%2Fkustomize+is:pull-request" $github_auth_string); then
61-
echo "Failed to fetch results for commits (exit code $?): $commitList"
62-
exit 1
53+
if [[ -z "${GITHUB_TOKEN-}" ]]; then
54+
echo "WARNING: Please set GITHUB_TOKEN to avoid GitHub API rate limits."
55+
if ! newResultsRaw=$(curl -sSL "https://api.github.com/search/issues?q=$commitList+repo%3Akubernetes-sigs%2Fkustomize+is:pull-request"); then
56+
echo "Failed to fetch results for commits (exit code $?): $commitList"
57+
exit 1
58+
fi
59+
else
60+
if ! newResultsRaw=$(curl -sSL "https://api.github.com/search/issues?q=$commitList+repo%3Akubernetes-sigs%2Fkustomize+is:pull-request" -H "Authorization: Bearer $GITHUB_TOKEN"); then
61+
echo "Failed to fetch results for commits (exit code $?): $commitList"
62+
exit 1
63+
fi
6364
fi
65+
6466
if [[ "${newResultsRaw}" == *"API rate limit exceeded"* ]]; then
65-
echo "GitHub API rate limit exceeded. Please set GITHUB_USERNAME and GITHUB_TOKEN to avoid this."
67+
echo "GitHub API rate limit exceeded. Please set GITHUB_TOKEN to avoid this."
6668
exit 1
6769
fi
6870

0 commit comments

Comments
 (0)