Tag Bump Version #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tag Bump Version | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_branch: | |
description: Branch to bump version (Separate branches by commas. Ex v1.73,v2.4) | |
required: true | |
default: v1.73 | |
type: string | |
jobs: | |
initialize: | |
name: Initialize | |
runs-on: ubuntu-latest | |
outputs: | |
branches: ${{ env.branches }} | |
steps: | |
- name: Prepare script to var | |
id: script_convert | |
run: | | |
cat <<-EOF > conversor.py | |
import sys, json | |
branch_arg = sys.argv[1] | |
branches = branch_arg.split(',') | |
print(json.dumps(branches)) | |
EOF | |
- name: Set Branch | |
id: branches | |
env: | |
TAG_BRANCHES: ${{ github.event.inputs.tag_branch }} | |
run: | | |
BRANCHES=$(python conversor.py $TAG_BRANCHES) | |
echo "branches=$BRANCHES" >> $GITHUB_ENV | |
bump_version: | |
needs: [initialize] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
branch: ${{fromJson(needs.initialize.outputs.branches)}} | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{matrix.branch}} | |
- name: Prepare scripts | |
run: | | |
cat <<-EOF > bump.py | |
import sys | |
release_type = sys.argv[1] | |
version = sys.argv[2] | |
parts = version.split('.') | |
major = int(parts[0][1:]) | |
minor = int(parts[1]) | |
patch = int(parts[2]) | |
if release_type == 'major': | |
major = major + 1 | |
minor = 0 | |
patch = 0 | |
elif release_type == 'minor': | |
minor = minor + 1 | |
patch = 0 | |
elif release_type == 'patch': | |
patch = patch + 1 | |
print('.'.join(['v' + str(major), str(minor), str(patch)])) | |
EOF | |
- name: Configure git | |
run: | | |
git config user.email '[email protected]' | |
git config user.name 'kiali-bot' | |
- name: Copy Kiali source code | |
env: | |
BRANCH: ${{matrix.branch}} | |
run: | | |
hack/copy-frontend-src-to-ossmc.sh --source-ref "$BRANCH" | |
- name: Create Bump Version Tag in kiali/openshift-servicemesh-plugin | |
env: | |
BRANCH: ${{matrix.branch}} | |
run: | | |
RAW_VERSION=$(sed -rn 's/^VERSION \?= (.*)/\1/p' Makefile) | |
RELEASE_VERSION=$(python bump.py patch $RAW_VERSION) | |
hack/update-version-string.sh "$RELEASE_VERSION" | |
git add Makefile plugin/package.json | |
if [[ $BRANCH != "v1.73" ]]; then | |
git add plugin/plugin-metadata.ts | |
fi | |
# Commit the changes | |
git commit -m "Bump to version $RELEASE_VERSION" | |
git push origin $(git rev-parse HEAD):refs/heads/$BRANCH | |
# Create the bump version tag | |
git push origin $(git rev-parse HEAD):refs/tags/$RELEASE_VERSION-ossm |