Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ItayTheDar committed Jul 22, 2023
2 parents 88fdfc2 + c7ab1e5 commit 76b2df3
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion .github/workflows/release_beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ on:
- ItayTheDar
inputs:
increment_version:
description: 'Create a new beta release, deploy to TestPyPI, and install the package'
description: 'Increment version by major, minor, or patch'
required: true
default: 'patch'
type: choice
options:
- major
- minor
- patch


env:
VERSION_FILE_PATH: nest/__init__.py
Expand All @@ -29,11 +37,45 @@ jobs:
with:
token: ${{ secrets.RELEASE_GIT_TOKEN }}

- name: Set version
run: |
VERSION_REGEX='^(__version__ = \")(([[:digit:]]+\.)*[[:digit:]]+)((a|b|rc)[[:digit:]]+)?(\.post[[:digit:]]+)?(.dev[[:digit:]]+)?(\")$'
# get current version from version file
CURRENT_VERSION=`sed -n -E "s/$VERSION_REGEX/\2/p" $VERSION_FILE_PATH`
echo "Current version: $CURRENT_VERSION"
# switch case for incrementing_version based on input
case ${{ inputs.increment_version }} in
major)
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{$1=$1+1; $2=0; $3=0; print $0}' OFS=".")
;;
minor)
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{$2=$2+1; $3=0; print $0}' OFS=".")
;;
patch)
NEW_VERSION=$(echo $CURRENT_VERSION | awk -F. '{$3=$3+1; print $0}' OFS=".")
;;
*)
echo "Invalid input for increment_version"
exit 1
;;
esac
echo "New version: $NEW_VERSION"
echo "RELEASE_VERSION=$NEW_VERSION" >> $GITHUB_ENV
# update version file
sed -i -E "s/$VERSION_REGEX/\1$NEW_VERSION\8/" $VERSION_FILE_PATH
- name: Install python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Update CHANGELOG.md
run: git-changelog . -o $CHANGELOG_FILE_PATH

- name: Install python dependencies
run: |
pip install --upgrade pip
Expand Down

0 comments on commit 76b2df3

Please sign in to comment.