forked from alexandru-slobodcicov/liquibase-mongodb
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #383 from liquibase/DAT-15071
DAT-15071 Automatically bump version on mongodb via the release workflow
- Loading branch information
Showing
2 changed files
with
33 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected] | ||
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 "[email protected]" | ||
- 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:[email protected]/$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 "[email protected]" | ||
- 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:[email protected]/$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/[email protected] | ||
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/[email protected] | ||
with: | ||
perform-release: false | ||
perform-rollback: true | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters