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

[INFRA-1118] Add minor release detection #1154

Merged
merged 2 commits into from
Dec 2, 2024
Merged
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
53 changes: 49 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,53 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
ref: main

- name: Minor Release Check
id: minor_release
run: |
version="$INPUT_VERSION"

# Check if version is in format number.number.number
if ! [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format. It should be in format 'number.number.number'."
exit 1
fi

# Extract the third number
IFS='.' read -r -a version_parts <<< "$version"
third_number="${version_parts[2]}"

# Check if it's a minor release
if [ "$third_number" -eq 0 ]; then
echo "Minor release detected."
echo "is_minor=true" >> $GITHUB_ENV
else
echo "Not a minor release. Skipping branch creation."
echo "is_minor=false" >> $GITHUB_ENV
fi

- name: Create and Push New Release Branch
if: env.is_minor == 'true'
run: |
version="$INPUT_VERSION"
IFS='.' read -r -a version_parts <<< "$version"
release_branch="${version_parts[0]}.${version_parts[1]}.x"

git fetch origin
git checkout origin/main
git checkout -b $release_branch
git push origin $release_branch

- name: Check-out Release Branch
run: |
version="$INPUT_VERSION"
IFS='.' read -r -a version_parts <<< "$version"
release_branch="${version_parts[0]}.${version_parts[1]}.x"
echo "base_branch=${version_parts[0]}.${version_parts[1]}.x" >> $GITHUB_ENV
echo $base_branch

git checkout $release_branch
git branch

- name: Setup Python Environment
uses: ./.github/actions/setup-python-env
Expand All @@ -38,7 +84,6 @@ jobs:
run: |
git config user.name "rasabot"
git config user.email "[email protected]"
git checkout -b prepare-release-$INPUT_VERSION
poetry run python scripts/release.py --next_version $INPUT_VERSION
env:
INPUT_VERSION: ${{ github.event.inputs.version }}
Expand All @@ -47,8 +92,8 @@ jobs:
uses: devops-infra/action-pull-request@e66e2ba93519dc63b9884a26e620e2fd0cffab2c # v0.5.5
with:
github_token: ${{ env.GITHUB_TOKEN }}
source_branch: prepare-release-${{ env.VERSION }}
target_branch: main
source_branch: prepare-release-${{ env.INPUT_VERSION }}
target_branch: ${{ env.base_branch }}
body: "**Automated pull request for Rasa SDK release.**"
title: Release ${{ github.event.inputs.version }}
env:
Expand Down