Skip to content

Commit

Permalink
Support dev and rc releases in release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rasa-aadlv committed Dec 26, 2024
1 parent 346a5c6 commit 90e9162
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 71 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/dev-release.yml

This file was deleted.

47 changes: 34 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
version:
description: 'Version to release'
required: true
fromMain:
description: 'Release from main?'
type: boolean
required: true
default: false
pull_request:
branches:
- main
Expand All @@ -17,6 +22,7 @@ env:
DEFAULT_PYTHON_VERSION: "3.10"
GITHUB_TOKEN: ${{ secrets.RASASDK_GITHUB_TOKEN }}
INPUT_VERSION: ${{ github.event.inputs.version }}
RELEASE_FOM_MAIN: ${{ github.event.inputs.fromMain }}

jobs:
prepare-the-release:
Expand All @@ -29,32 +35,41 @@ jobs:
with:
fetch-depth: 0

- name: Minor Release Check
id: minor_release
- name: Dev or RC Release - Check if this is DEV or RC release
id: dev_or_rc_check
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
# Check if version contains 'dev' or 'rc'
if [[ "$version" == *"dev"* || "$version" == *"rc"* ]]; then
echo "Dev or RC release detected."
echo "is_dev=true" >> $GITHUB_ENV
else
echo "Not a Dev or RC release."
echo "is_dev=false" >> $GITHUB_ENV
fi
- name: Minor Release - Check if this is a minor release
if: env.is_dev == 'false'
id: minor_release
run: |
version="$INPUT_VERSION"
# 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
# Check if third number is equivalent to 0 and no trailing chars
if [[ "$third_number" =~ ^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'
- name: Minor Release - Create and push new minor release branch
if: ${{ env.is_minor == 'true' && env.is_dev == 'false' }}
run: |
version="$INPUT_VERSION"
IFS='.' read -r -a version_parts <<< "$version"
Expand All @@ -65,7 +80,8 @@ jobs:
git checkout -b $release_branch
git push origin $release_branch
- name: Check-out Release Branch
- name: Check-out .x branch
if: env.RELEASE_FOM_MAIN == 'false'
run: |
version="$INPUT_VERSION"
IFS='.' read -r -a version_parts <<< "$version"
Expand All @@ -76,6 +92,11 @@ jobs:
git checkout $release_branch
git branch
- name: Check-out main branch
if: env.RELEASE_FOM_MAIN == 'true'
run: |
git checkout main
- name: Setup Python Environment
uses: ./.github/actions/setup-python-env
with:
Expand Down

0 comments on commit 90e9162

Please sign in to comment.