blob: c2d5a96faedc012ec575e6456462e1d4c34a4a39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
name: Init Argo CD Image Updater Release
on:
workflow_dispatch:
inputs:
TARGET_BRANCH:
description: 'TARGET_BRANCH to checkout (e.g. release-0.14)'
required: true
type: string
TARGET_VERSION:
description: 'TARGET_VERSION to build manifests (e.g. 0.14.0-rc1) Note: the `v` prefix is not used'
required: true
type: string
permissions: {}
env:
TARGET_REMOTE: upstream
TARGET_TAG: "v${{ inputs.TARGET_VERSION }}"
jobs:
prepare-release:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: Automatically generate version and manifests on ${{ inputs.TARGET_BRANCH }}
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@8410ad0602e1e429cee44a835ae9f77f654a6694 # v4.0.0
with:
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ inputs.TARGET_BRANCH }}
- name: Check if TARGET_VERSION is well formed.
run: |
set -ue
# Target version must not contain 'v' prefix
if echo "${{ inputs.TARGET_VERSION }}" | grep -e '^v'; then
echo "::error::Target version '${{ inputs.TARGET_VERSION }}' should not begin with a 'v' prefix, refusing to continue." >&2
exit 1
fi
if ! echo "${{ inputs.TARGET_VERSION }}" | egrep -q '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Error: Target version '${{ inputs.TARGET_VERSION }}' is not well-formed. Must be X.Y.Z" >&2
exit 1
fi
- name: Checking for current git branch
run: |
set -ue
RELEASE_BRANCH=$(git rev-parse --abbrev-ref HEAD || true)
if [[ $RELEASE_BRANCH = release-* ]]; then
echo "*** branch is $RELEASE_BRANCH"
else
echo "Error: Branch $RELEASE_BRANCH is not release branch" >&2
exit 1
fi
- name: Checking for existence of git tag
run: |
set -ue
if git show-ref --tags "${{ env.TARGET_TAG }}" --quiet; then
echo "Error: Tag with version ${{ env.TARGET_TAG }} already exists." >&2
exit 1
fi
- name: Create VERSION information
run: |
set -ue
if ! test -f VERSION; then
echo "Error: You should be in repository root." >&2
exit 1
fi
echo "Bumping version from $(cat VERSION) to ${{ inputs.TARGET_VERSION }}"
echo "${{ inputs.TARGET_VERSION }}" > VERSION
- name: Install Kustomize
uses: imranismail/setup-kustomize@v2
with:
kustomize-version: '5.2.1'
- name: Generate new set of manifests
run: |
set -ue
echo kustomize version $(kustomize version)
make manifests IMAGE_TAG="${{ env.TARGET_TAG }}"
git diff
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
commit-message: "Bump version to ${{ inputs.TARGET_VERSION }}"
title: "Bump version to ${{ inputs.TARGET_VERSION }} on ${{ inputs.TARGET_BRANCH }} branch"
body: Updating VERSION and manifests to ${{ inputs.TARGET_VERSION }}
branch: update-version
branch-suffix: random
signoff: true
labels: release
- name: Next steps
run: |
echo "Created release PR: ${{ steps.create-pull-request.outputs.pull-request-url }}"
echo "Once this PR is merged, pull from ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }}, tag the release, and build release artifacts."
echo "If everything is fine, push changes to GitHub and container registry:"
echo " git fetch ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }}"
echo " git switch ${{ inputs.TARGET_BRANCH }}"
echo " git pull ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }}"
echo " git tag ${{ env.TARGET_TAG }}"
echo " make multiarch-image"
echo " make release-binaries"
echo " git push ${{ env.TARGET_REMOTE }} ${{ inputs.TARGET_BRANCH }} ${{ env.TARGET_TAG }}"
echo " make IMAGE_TAG='${{ env.TARGET_TAG }}' multiarch-image-push"
echo
echo "Then, create release tag and execute upload-multiarch-release-assets.sh"
|