diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 7d4fb73..397a554 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -2,26 +2,18 @@ name: Release to Maven Central on: release: - types: [ published ] + types: [ released ] permissions: contents: write - - jobs: - build-for-release: + release: runs-on: ubuntu-latest - + outputs: + new-version: ${{ steps.version.outputs.version }} steps: - uses: actions/checkout@v4 - with: - ref: master - - name: Setup git config - run: | - git config user.name github-actions - git config user.email github-actions@github.com - - name: Set up JDK 19 uses: actions/setup-java@v4 with: @@ -33,14 +25,44 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_CENTRAL_TOKEN - - if: github.event.release - name: Update version in pom.xml (Release only) - run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false + - name: Get next version + uses: reecetech/version-increment@2023.9.3 + id: version + with: + release_branch: master + scheme: semver + increment: patch + + - name: Update version in pom.xml + run: mvn -B versions:set -DnewVersion=${{ steps.version.outputs.version }} -DgenerateBackupPoms=false + - name: Verify and deploy run: mvn -B deploy --file pom.xml env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + after-release: + runs-on: ubuntu-latest + needs: release + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ env.DEV_BRANCH }} + + - name: Setup git config + run: | + git config user.name github-actions + git config user.email github-actions@github.com + + - name: Setup next version + run: mvn -B versions:set -DnewVersion=${{ needs.release.outputs.new-version }}-SNAPSHOT -DgenerateBackupPoms=false + + - name: Commit and push + run: | + git add -A + git commit -m "Prepare pom for new iteration" + git push - name: Update dependency graph uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 diff --git a/pom.xml b/pom.xml index 0d9a5d6..4567abe 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ io.github.codeblo rollbacker - 0.0.1-SNAPSHOT + 0.0.3-SNAPSHOT jar