Skip to content

Commit ae57cce

Browse files
Merge pull request #8 from DiogoRibeiro7/feat/first_commit
Feat/first commit
2 parents 476ba81 + 3d18b02 commit ae57cce

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

.github/workflows/bump-version.yml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,34 @@ jobs:
4141
- name: Run Semantic Release
4242
env:
4343
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
run: poetry run semantic-release publish
44+
run: semantic-release publish
4545

46-
- name: Push changes
46+
# - name: Push changes
47+
# run: |
48+
# git push --follow-tags
49+
50+
- name: "Determine version bump type"
51+
run: |
52+
git fetch --tags
53+
# This defaults to a patch type, unless a feature commit was pushed, then set type to minor
54+
LAST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
55+
LAST_COMMIT=$(git log -1 --format='%H')
56+
echo "Last git tag: $LAST_TAG"
57+
echo "Last git commit: $LAST_COMMIT"
58+
echo "Commits:"
59+
git log --no-merges --pretty=oneline $LAST_TAG...$LAST_COMMIT
60+
git log --no-merges --pretty=format:"%s" $LAST_TAG...$LAST_COMMIT | grep -q ^feat: && BUMP_TYPE="minor" || BUMP_TYPE="patch"
61+
echo "Version bump type: $BUMP_TYPE"
62+
echo "BUMP_TYPE=$BUMP_TYPE" >> $GITHUB_ENV
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
- name: "Version bump"
4766
run: |
48-
git push --follow-tags
67+
poetry version $BUMP_TYPE
68+
- name: "Push new version"
69+
run: |
70+
git add pyproject.toml
71+
git commit -m "Update version to $(poetry version -s)"
72+
git push origin HEAD:${{ github.event.pull_request.head.ref }}
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)