Skip to content

Commit

Permalink
ci: script to update version after release
Browse files Browse the repository at this point in the history
  • Loading branch information
jy95 committed Jan 29, 2025
1 parent 300df87 commit 6d4c6ab
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/set-next-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@ name: Set next version
on:
release:
types: [created]
workflow_dispatch:

jobs:
extract_version:
runs-on: ubuntu-latest
outputs:
next_patch: ${{ steps.semvers.outputs.patch }}
steps:
- uses: actions/checkout@v4
- name: Fetch latest tag if manually triggered
id: get_latest_tag
if: github.event_name == 'workflow_dispatch'
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT
- name: 🤖 Get next minor version
id: semvers
uses: WyriHaximus/github-action-next-semvers@v1.2.1
with:
version: ${{ steps.get_latest_tag.outputs.latest_tag || github.event.release.tag_name }}

version_bump:
runs-on: ubuntu-latest
needs: extract_version
permissions:
contents: write
pull-requests: write
Expand All @@ -18,16 +38,12 @@ jobs:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: 🤖 Get next minor version
id: semvers
uses: WyriHaximus/github-action-next-semvers@v1.2.1
with:
version: ${{ github.event.release.tag_name }}
- name: Update Maven POM
run: |
mvn versions:set-property -Dproperty=revision -DnewVersion=${{ steps.semvers.outputs.patch }}-SNAPSHOT -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=revision -DnewVersion=${{ needs.extract_version.outputs.next_patch }}-SNAPSHOT -DgenerateBackupPoms=false
- name: 💅 Create Pull Request
uses: peter-evans/create-pull-request@v7.0.5
with:
title: "chore: Update POM version to ${{ steps.semvers.outputs.patch }}-SNAPSHOT 🤖"
branch: "automated/version-bump"
title: "chore: Update POM version to ${{ needs.extract_version.outputs.next_patch }}-SNAPSHOT 🤖"
branch: "automated/version-bump-${{ github.run_id }}"
base: main

0 comments on commit 6d4c6ab

Please sign in to comment.