diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 44d98af2..55d7854b 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -38,6 +38,13 @@ jobs: echo "Saw Liquibase version ${{ steps.collect-data.outputs.liquibaseVersion }}" echo "Saw Extension version ${{ steps.collect-data.outputs.extensionVersion }}" + release-prepare: + uses: liquibase/build-logic/.github/workflows/extension-update-version.yml@v0.3.2 + with: + perform-release: false + perform-rollback: false + secrets: inherit + build: name: "Build and Test" runs-on: ubuntu-latest @@ -62,11 +69,6 @@ jobs: java-version: '8' distribution: 'adopt' - - name: Configure git user - run: | - git config user.name "liquibot" - git config user.email "liquibot@liquibase.org" - - name: Download and install liquibase-core.jar uses: dsaltares/fetch-gh-release-asset@master with: @@ -79,24 +81,6 @@ jobs: - name: Install liquibase-core.jar run: mvn -B org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=liquibase-core.jar - - name: Update pom.xml with release versions and commit changes - run: | - mvn -B versions:set -DnewVersion=${{ needs.setup.outputs.extensionVersion }} -DallowSnapshots=false -DoldVersion="*" - mvn -B versions:use-dep-version -Dincludes=org.liquibase:liquibase-core -DdepVersion=${{ needs.setup.outputs.liquibaseVersion }} -DforceVersion=true - - git add pom.xml - if git diff-index --cached --quiet HEAD -- - then - echo "Nothing new to commit" - else - git commit -m "Version Bumped to ${{ needs.setup.outputs.extensionVersion }}" - fi - git tag -a -m "Version Bumped to ${{ needs.setup.outputs.extensionVersion }}" liquibase-mongodb-${{ needs.setup.outputs.extensionVersion }} - git push "https://liquibot:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:${{ github.ref }} --follow-tags --tags - - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} - - name: Get release SHA id: get-release-sha run: echo ::set-output name=releaseSha::$(git rev-parse HEAD) @@ -144,7 +128,7 @@ jobs: run: mvn clean verify -Prun-its --file pom.xml draft-release: - needs: [ setup, build, integration-tests ] + needs: [ setup, build, integration-tests, release-prepare ] name: Draft Release runs-on: ubuntu-latest steps: @@ -167,33 +151,20 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - bump-pom-to-snapshot: - name: Prepare POM for Development - runs-on: ubuntu-latest - needs: [ draft-release ] - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token - fetch-depth: 0 # otherwise, you will failed to push refs to dest repo - - - name: Set up JDK - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - - - name: Configure git user - run: | - git config user.name "liquibot" - git config user.email "liquibot@liquibase.org" - - - name: Prepare code for next version - run: | - git pull - mvn -B versions:set -DnextSnapshot=true - git add pom.xml - git commit -m "Version Bumped to Snapshot for Development" - git push "https://liquibot:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:${{ github.ref }} --follow-tags --tags - env: - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + release-perform: + needs: [ setup, release-prepare, build, integration-tests, draft-release ] + if: ${{ success() }} + uses: liquibase/build-logic/.github/workflows/extension-update-version.yml@v0.3.2 + with: + perform-release: true + perform-rollback: false + secrets: inherit + + release-rollback: + needs: [ setup, release-prepare, build, integration-tests, draft-release ] + if: ${{ failure() }} + uses: liquibase/build-logic/.github/workflows/extension-update-version.yml@v0.3.2 + with: + perform-release: false + perform-rollback: true + secrets: inherit diff --git a/pom.xml b/pom.xml index fff014b8..fcdd2c81 100644 --- a/pom.xml +++ b/pom.xml @@ -335,6 +335,14 @@ https://oss.sonatype.org/ + + org.apache.maven.plugins + maven-release-plugin + ${maven-release-plugin.version} + + [Version Bumped to ${project.version}] + +