Skip to content

Commit e238bd6

Browse files
authored
Add GitHub Action for tagging releases and creating release branches (#2881)
1 parent a92e689 commit e238bd6

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

.github/workflows/tag-release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: tag-release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'release-*'
8+
paths:
9+
- version.txt
10+
11+
jobs:
12+
tag-release:
13+
if: ${{ github.repository == 'kubernetes-sigs/aws-load-balancer-controller' }}
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- run: /usr/bin/git config --global user.email [email protected]
24+
- run: /usr/bin/git config --global user.name 'GitHub Actions Release Tagger'
25+
- run: hack/tag-release.sh

docs/release.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# AWS Load Balancer Controller Release Process
2+
3+
## Create the Release Commit
4+
5+
Run `hack/set-version` to set the new version number and commit the resulting changes.
6+
This is called the "release commit".
7+
8+
## Merge the Release Commit
9+
10+
Create a pull request with the release commit. Get it reviewed and merged to `main`.
11+
12+
Upon merge to `main`, GitHub Actions will create a release tag for the new release.
13+
14+
If the release is a ".0-beta.1" release, GitHub Actions will also create a release branch
15+
for the minor version.
16+
17+
(Remaining steps in process yet to be documented.)

hack/tag-release.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash -xe
2+
3+
# Copyright 2022 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
VERSION=$(cat version.txt)
18+
19+
if [[ ! "${VERSION}" =~ ^([0-9]+[.][0-9]+)[.]([0-9]+)(-(alpha|beta)[.]([0-9]+))?$ ]]; then
20+
echo "Version ${VERSION} must be 'X.Y.Z', 'X.Y.Z-alpha.N', or 'X.Y.Z-beta.N'"
21+
exit 1
22+
fi
23+
24+
MINOR=${BASH_REMATCH[1]}
25+
RELEASE_BRANCH="release-${MINOR}"
26+
27+
if [ "$(git tag -l "v${VERSION}")" ]; then
28+
echo "Tag v${VERSION} already exists"
29+
exit 0
30+
fi
31+
32+
git tag -a -m "Release ${VERSION}" "v${VERSION}"
33+
git push origin "v${VERSION}"
34+
35+
if [[ ! "${VERSION}" =~ .0-beta.1$ ]]; then
36+
exit 0
37+
fi
38+
39+
git branch "${RELEASE_BRANCH}"
40+
git push origin "${RELEASE_BRANCH}"

0 commit comments

Comments
 (0)