Skip to content

Commit

Permalink
Merge pull request #1154 from RasaHQ/INFRA-1118
Browse files Browse the repository at this point in the history
[INFRA-1118] Add minor release detection
  • Loading branch information
rasa-aadlv authored Dec 2, 2024
2 parents 27c4184 + d7aa42a commit 0e478bd
Showing 1 changed file with 49 additions and 4 deletions.
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

0 comments on commit 0e478bd

Please sign in to comment.