Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAT-15071 Automatically bump version on mongodb via the release workflow #383

Merged
merged 4 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 25 additions & 54 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,14 @@
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<scmCommentPrefix>[Version Bumped to ${project.version}]</scmCommentPrefix>
</configuration>
</plugin>
</plugins>

</build>
Expand Down