diff --git a/release/create_draft_release.sh b/release/create_draft_release.sh index 88d725f2..ca5ffc93 100755 --- a/release/create_draft_release.sh +++ b/release/create_draft_release.sh @@ -2,31 +2,23 @@ set -ex # This script will be called when a new content was merged to the main branch. -# It will create a new draft release with the new weka version. +# It will create a new draft release. +export new_tag="$1" -export new_weka_version="$1" +if [ -z "$new_tag" ] +then + echo "Calculating next tag" + source release/calculate_next_tag.sh +else + echo "Using provided tag: $new_tag" +fi git checkout main git pull -git fetch --tags -latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)") -echo "latest tag: $latest_tag" -major=$(echo "$latest_tag" | cut -d. -f1) -major="${major:1}" # remove v -minor=$(echo "$latest_tag" | cut -d. -f2) -patch=$(echo "$latest_tag" | cut -d. -f3) -new_patch=$((patch + 1)) -new_tag="v$major.$minor.$new_patch" -echo "new tag: $new_tag" git tag "$new_tag" git push origin "$new_tag" -if [ -z "$new_weka_version" ] -then - message="Fill release notes here." -else - message="Updated WEKA default version to $new_weka_version" -fi +message="Fill release notes here." gh release create "$new_tag" --draft --title "$new_tag" --notes "- $message" diff --git a/release/create_new_release_branch.sh b/release/create_new_release_branch.sh index 0b5aa4da..1230852a 100755 --- a/release/create_new_release_branch.sh +++ b/release/create_new_release_branch.sh @@ -1,18 +1,13 @@ #!/bin/bash set -ex -# By default, new terraform releases will be aligned with new weka version releases. -# This script will be used for this release flow, i.e. when a new weka release is published. -# For terraform module hot fixes we will have a different release flow. -# prerequisites: github cli: https://cli.github.com/ - -export new_weka_version="$1" +export new_tag="$1" export base_branch="$2" -if [ -z "$new_weka_version" ] +if [ -z "$new_tag" ] then - echo "Please provide the new weka version" - exit 1 + echo "Calculating next tag" + source release/calculate_next_tag.sh fi if [ -z "$base_branch" ] @@ -22,25 +17,17 @@ fi git checkout "$base_branch" git pull -git checkout -b "$base_branch-$new_weka_version" -old_weka_version=$(awk '/WEKA version/{getline;print $NF;}' variables.tf | tr -d \") +git checkout -b "$base_branch-$new_tag" -file_paths=( - variables.tf - examples/private_vpc_create_worker_pool/main.tf - examples/private_vpc_with_peering/main.tf -) -for file_path in "${file_paths[@]}"; do - if [[ "$OSTYPE" == "darwin"* ]]; then - sed -i '' "s/$old_weka_version/$new_weka_version/" "$file_path" - else - sed -i "s/$old_weka_version/$new_weka_version/" "$file_path" - fi - git add "$file_path" -done +if [[ "$OSTYPE" == "darwin"* ]]; then + sed -i '' 's/= "dev"/= "release"/' variables.tf +else + sed -i 's/= "dev"/= "release"/' variables.tf +fi +git add variables.tf +git commit -m "chore: update function app distribution to release" || true -git commit -m "chore: update weka default version: $new_weka_version" -git push --set-upstream origin "$base_branch-$new_weka_version" +git push --set-upstream origin "$base_branch-$new_tag" capitalized_base_branch=$(echo "$base_branch" | awk '{print toupper(substr($0, 1, 1)) tolower(substr($0, 2))}') -gh pr create --base main --title "$capitalized_base_branch $new_weka_version" --body "" +gh pr create --base main --title "$capitalized_base_branch $new_tag" --body "" gh pr view --web