0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-07-04 12:32:57 +00:00

feat: Use new action to calculate next version

This commit is contained in:
alex289 2024-04-26 11:35:08 +02:00
parent 93e1e3ba56
commit 8fa1a41c09
No known key found for this signature in database
GPG Key ID: 573F77CD2D87F863

View File

@ -13,44 +13,56 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: calculate version - name: Get next version
id: calculate-version id: get_next_version
uses: bitshifted/git-auto-semver@v1 uses: thenativeweb/get-next-version@main
with:
prefix: 'v'
- name: Show the next version
run: |
echo ${{ steps.get_next_version.outputs.version }}
echo ${{ steps.get_next_version.outputs.hasNextVersion }}
- name: Get previous tag - name: Get previous tag
id: previousTag id: previousTag
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: | run: |
name=$(git --no-pager tag --sort=creatordate | tail -2 | head -1) name=$(git --no-pager tag --sort=creatordate | tail -1)
echo "previousTag: $name" echo "previousTag: $name"
echo "previousTag=$name" >> $GITHUB_ENV echo "previousTag=$name" >> $GITHUB_ENV
- name: Create new tag - name: Create new tag
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
run: | run: |
git tag -a ${{ steps.calculate-version.outputs.version-string }} -m "Release ${{ steps.calculate-version.outputs.version-string }}" git tag -a ${{ steps.get_next_version.outputs.version }} -m "Release ${{ steps.get_next_version.outputs.version }}"
git push origin ${{ steps.calculate-version.outputs.version-string }} git push origin ${{ steps.get_next_version.outputs.version }}
git checkout main git checkout main
- name: Update CHANGELOG - name: Update CHANGELOG
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
id: changelog id: changelog
uses: requarks/changelog-action@v1 uses: requarks/changelog-action@v1
with: with:
token: ${{ github.token }} token: ${{ github.token }}
fromTag: ${{ github.calculate-version.outputs.version-string }} fromTag: ${{ steps.get_next_version.outputs.version }}
toTag: ${{ env.previousTag }} toTag: ${{ env.previousTag }}
- name: Create Release - name: Create Release
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: ncipollo/release-action@v1.14.0 uses: ncipollo/release-action@v1.14.0
with: with:
allowUpdates: true allowUpdates: true
draft: false draft: false
makeLatest: true makeLatest: true
name: ${{ github.calculate-version.outputs.version-string }} name: ${{ steps.get_next_version.outputs.version }}
body: ${{ steps.changelog.outputs.changes }} body: ${{ steps.changelog.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Commit CHANGELOG.md - name: Commit CHANGELOG.md
if: ${{ steps.get_next_version.outputs.hasNextVersion == 'true' }}
uses: stefanzweifel/git-auto-commit-action@v5 uses: stefanzweifel/git-auto-commit-action@v5
with: with:
branch: main branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.calculate-version.outputs.version-string }} [skip ci]' commit_message: 'docs: update CHANGELOG.md for ${{ steps.get_next_version.outputs.version }} [skip ci]'
file_pattern: CHANGELOG.md file_pattern: CHANGELOG.md