Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possiblity to do a major release #292

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 36 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: Release

on:
schedule:
#schedule:
# Every Monday at 08:00 (UTC) - try to make sure it happens after all Kiali-related images are released
- cron: '00 8 * * MON'
#- cron: '00 8 * * MON'
workflow_dispatch:
inputs:
release_type:
description: Release type
required: true
type: choice
options:
- major
- minor
- patch
release_branch:
Expand Down Expand Up @@ -104,6 +105,9 @@ jobs:
then
RELEASE_VERSION=$(python bump.py $RELEASE_TYPE $RELEASE_VERSION)
elif [[ $RELEASE_TYPE == "minor" ]]
then
RELEASE_VERSION=$RELEASE_VERSION
elif [[ $RELEASE_TYPE == "major" ]]
then
RELEASE_VERSION=$RELEASE_VERSION
fi
Expand All @@ -122,7 +126,10 @@ jobs:
NEXT_VERSION=$(python bump.py $RELEASE_TYPE $RELEASE_VERSION)
elif [[ $RELEASE_TYPE == "minor" ]]
then
NEXT_VERSION=$(python bump.py $RELEASE_TYPE $RELEASE_VERSION)
NEXT_VERSION=$(python bump.py $RELEASE_TYPE $RELEASE_VERSION)
elif [[ $RELEASE_TYPE == "major" ]]
then
NEXT_VERSION=$(python bump.py "minor" $RELEASE_VERSION)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea if this is right or wrong, but this just caught my eye. Since release type is "major" here, shouldn't the bump.py be sent in "major" as its argument value?

Suggested change
NEXT_VERSION=$(python bump.py "minor" $RELEASE_VERSION)
NEXT_VERSION=$(python bump.py "major" $RELEASE_VERSION)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that case, which is calculate the next version, the bump shouldn't be to 3.0, but to 2.1 instead, for that reason I'm setting a minor bump there.

fi

echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -202,11 +209,12 @@ jobs:
env:
BUILD_TAG: helm-charts-release-${{ github.run_number }}-main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
# If we did a minor release, we need to create the vX.Y branch, so that it can
# If we did a minor or major release, we need to create the vX.Y branch, so that it can
# be used as a base for a patch release.
# Also, we create a vX.Y.Z tag.
if [[ $RELEASE_TYPE == "minor" ]]
if [[ $RELEASE_TYPE == "minor" || $RELEASE_TYPE == "major" ]]
then
git push origin $(git rev-parse HEAD):refs/heads/$BRANCH_VERSION

Expand All @@ -220,13 +228,19 @@ jobs:
git commit -m "Prepare for next version"

git push origin $(git rev-parse HEAD):refs/heads/$BUILD_TAG

if hack/smoke-test-release-branch.sh --release-branch $BUILD_TAG; then
prtitle="Prepare for next version (smoke test passed)"
prmsg="The smoke test has passed. Please merge to update version numbers and prepare for release $NEXT_VERSION"

if [[ $GITHUB_REPOSITORY == 'kiali/helm-charts' ]]
then
if hack/smoke-test-release-branch.sh --release-branch $BUILD_TAG; then
prtitle="Prepare for next version (smoke test passed)"
prmsg="The smoke test has passed. Please merge to update version numbers and prepare for release $NEXT_VERSION"
else
prtitle="[DO NOT MERGE YET] Prepare for next version"
prmsg="DO NOT MERGE YET! The smoke test failed. Please fix the problem before merging this PR which updates version numbers and prepares for release $NEXT_VERSION"
fi
else
prtitle="[DO NOT MERGE YET] Prepare for next version"
prmsg="DO NOT MERGE YET! The smoke test failed. Please fix the problem before merging this PR which updates version numbers and prepares for release $NEXT_VERSION"
prtitle="Prepare for next version (smoke test does not run on this repository)"
prmsg="The smoke test does not run on this repository. Please merge to update version numbers and prepare for release $NEXT_VERSION"
fi

gh pr create -t "$prtitle" -b "$prmsg" -H $BUILD_TAG -B $RELEASE_BRANCH
Expand All @@ -237,12 +251,18 @@ jobs:
then
git push origin $(git rev-parse HEAD):refs/heads/$BUILD_TAG

if hack/smoke-test-release-branch.sh --release-branch $BUILD_TAG; then
prtitle="Prepare for next version (smoke test passed)"
prmsg="The smoke test has passed. Please merge to update version numbers and prepare for release $NEXT_VERSION"
if [[ $GITHUB_REPOSITORY == 'kiali/helm-charts' ]]
then
if hack/smoke-test-release-branch.sh --release-branch $BUILD_TAG; then
prtitle="Prepare for next version (smoke test passed)"
prmsg="The smoke test has passed. Please merge to update version numbers and prepare for release $NEXT_VERSION"
else
prtitle="[DO NOT MERGE YET] Prepare for next version"
prmsg="DO NOT MERGE YET! The smoke test failed. Please fix the problem before merging this PR which updates version numbers and prepares for release $NEXT_VERSION"
fi
else
prtitle="[DO NOT MERGE YET] Prepare for next version"
prmsg="DO NOT MERGE YET! The smoke test failed. Please fix the problem before merging this PR which updates version numbers and prepares for release $NEXT_VERSION"
prtitle="Prepare for next version (smoke test does not run on this repository)"
prmsg="The smoke test does not run on this repository. Please merge to update version numbers and prepare for release $NEXT_VERSION"
fi

gh pr create -t "$prtitle" -b "$prmsg" -H $BUILD_TAG -B master
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ROOTDIR=$(CURDIR)
OUTDIR=${ROOTDIR}/_output

# Identifies the current build.
VERSION ?= v1.90.0-SNAPSHOT
VERSION ?= v2.0.0-SNAPSHOT
SEMVER ?= $(shell echo ${VERSION} | sed 's/^v//g')
COMMIT_HASH ?= $(shell git rev-parse HEAD)

Expand Down