1.5.0 #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prep Heat Release | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Extract Version Information | |
id: extract-version | |
if: contains(github.event.issue.labels.*.name, 'release-prep') | |
run: | | |
issue_title="${{ github.event.issue.title }}" | |
major=$(echo "$issue_title" | cut -d '.' -f 1) | |
minor=$(echo "$issue_title" | cut -d '.' -f 2) | |
patch=$(echo "$issue_title" | cut -d '.' -f 3) | |
echo "major=$major" >> $GITHUB_OUTPUT | |
echo "minor=$minor" >> $GITHUB_OUTPUT | |
echo "patch=$patch" >> $GITHUB_OUTPUT | |
- name: Delete Existing Version Update Branch | |
run: | | |
if [[ $(git branch -a | grep -c "workflows/version-update") -gt 0 ]]; then | |
git branch -D workflows/version-update | |
fi | |
- name: Create Release Branch | |
if: steps.extract-version.outputs.patch == 0 | |
run: | | |
git checkout -b release/${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.x | |
git push origin release/${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.x | |
- name: Bump Version | |
if: always() | |
run: | | |
git checkout -b workflows/version-update | |
sed -i "s/major: int = \([0-9]\+\)/major: int = ${{ steps.extract-version.outputs.major }}/g" heat/core/version.py | |
sed -i "s/minor: int = \([0-9]\+\)/minor: int = ${{ steps.extract-version.outputs.minor }}/g" heat/core/version.py | |
if [[ ${{ steps.extract-version.outputs.patch }} -eq 0 ]]; then | |
sed -i "s/micro: int = \([0-9]\+\)/micro: int = 0/g" heat/core/version.py | |
sed -i "s/extension: str = .*/extension: str = None/g" heat/core/version.py | |
else | |
sed -i "s/micro: int = \([0-9]\+\)/micro: int = $(( ${{ steps.extract-version.outputs.patch }} + 1 ))/g" heat/core/version.py | |
fi | |
git add heat/core/version.py | |
git commit -m "Bump version to ${{ steps.extract-version.outputs.major }}.${{ steps.extract-version.outputs.minor }}.${{ steps.extract-version.outputs.patch }}" | |
git push origin workflows/version-update |