Skip to content

Commit 4642894

Browse files
Merge pull request #13 from DiogoRibeiro7/feat/first_commit
Feat/first commit
2 parents 75b433e + 081ce3d commit 4642894

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/bump-version.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,30 @@ jobs:
3737
- name: Push changes
3838
run: |
3939
git push --follow-tags
40+
- name: "Install Poetry"
41+
run: pip install poetry
42+
- name: "Determine version bump type"
43+
run: |
44+
git fetch --tags
45+
# This defaults to a patch type, unless a feature commit was pushed, then set type to minor
46+
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
47+
LAST_COMMIT=$(git log -1 --format='%H')
48+
echo "Last git tag: $LAST_TAG"
49+
echo "Last git commit: $LAST_COMMIT"
50+
echo "Commits:"
51+
git log --no-merges --pretty=oneline $LAST_TAG...$LAST_COMMIT
52+
git log --no-merges --pretty=format:"%s" $LAST_TAG...$LAST_COMMIT | grep -q ^feat: && BUMP_TYPE="minor" || BUMP_TYPE="patch"
53+
echo "Version bump type: $BUMP_TYPE"
54+
echo "BUMP_TYPE=$BUMP_TYPE" >> $GITHUB_ENV
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
- name: "Version bump"
58+
run: |
59+
poetry version $BUMP_TYPE
60+
- name: "Push new version"
61+
run: |
62+
git add pyproject.toml
63+
git commit -m "Update version to $(poetry version -s)"
64+
git push origin HEAD:${{ github.event.pull_request.head.ref }}
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)