mirror of
https://github.com/fluxcd/flux2.git
synced 2025-11-02 18:58:33 +08:00
build: detect current version from kustomize
This allows controller components to be updated when they are not included as a Go Mod dependency, which is currently the case for the notification-controller.
This commit is contained in:
18
.github/workflows/update.yml
vendored
18
.github/workflows/update.yml
vendored
@ -18,18 +18,15 @@ jobs:
|
||||
|
||||
bump_version() {
|
||||
local RELEASE_VERSION=$(curl -s https://api.github.com/repos/fluxcd/$1/releases | jq -r 'sort_by(.published_at) | .[-1] | .tag_name')
|
||||
local CURRENT_VERSION=$(go list -m all | grep "github.com/fluxcd/$1/api" | awk '{print $2}')
|
||||
local CURRENT_VERSION=$(sed -n "s/\(.*$1\/.*?ref=\)//p;n" "manifests/bases/$1/kustomization.yaml")
|
||||
|
||||
if [[ "${RELEASE_VERSION}" != "${CURRENT_VERSION}" ]]; then
|
||||
# bump go mod
|
||||
go mod edit -require="github.com/fluxcd/$1/api@${RELEASE_VERSION}"
|
||||
|
||||
# bump kustomize
|
||||
sed -i "s/\($1\/.*?ref=\).*/\1${RELEASE_VERSION}/g" "manifests/bases/$1/kustomization.yaml"
|
||||
|
||||
# bump doc var
|
||||
if [[ $2 ]]; then
|
||||
sed -i "s/\($2:\s*.{{\s*'\)\(v[0-9.]\+\)\('\s*}}\)/\1${RELEASE_VERSION}\3/" .github/workflows/docs.yaml
|
||||
if [[ ! -z $(go list -m all | grep "github.com/fluxcd/$1/api" | awk '{print $2}') ]]; then
|
||||
# bump go mod
|
||||
go mod edit -require="github.com/fluxcd/$1/api@${RELEASE_VERSION}"
|
||||
fi
|
||||
|
||||
PR_BODY="$PR_BODY- $1 to ${RELEASE_VERSION}%0A"
|
||||
@ -38,9 +35,10 @@ jobs:
|
||||
|
||||
{
|
||||
# bump controller versions
|
||||
bump_version helm-controller HELM_VER
|
||||
bump_version kustomize-controller KUSTOMIZE_VER
|
||||
bump_version source-controller SOURCE_VER
|
||||
bump_version helm-controller
|
||||
bump_version kustomize-controller
|
||||
bump_version source-controller
|
||||
bump_version notification-controller
|
||||
|
||||
# add missing and remove unused modules
|
||||
go mod tidy
|
||||
|
||||
Reference in New Issue
Block a user