forked from helmholtz-analytics/heat
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (45 loc) · 2.23 KB
/
release-prep.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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