Skip to content

Commit

Permalink
Merge pull request #388 from liquibase/DAT-15071
Browse files Browse the repository at this point in the history
DAT-15071 automatically bump version via the release workflow
  • Loading branch information
jandroav authored Jun 28, 2023
2 parents 5208b89 + 7b699ea commit 3c1896c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
30 changes: 11 additions & 19 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ jobs:
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
uses: liquibase/build-logic/.github/workflows/[email protected]
needs: [ setup ]
secrets: inherit

build:
name: "Build and Test"
runs-on: ubuntu-latest
needs: setup
needs: [ setup, release-prepare]
outputs:
releaseSha: ${{ steps.get-release-sha.outputs.releaseSha }}
steps:
Expand All @@ -57,6 +55,11 @@ jobs:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

- name: Update branch with latest commits # needed for getting the latest pom.xml generated by release-prepare step
run: |
git pull origin ${{ env.GITHUB_REF_NAME }}
git checkout HEAD~1
- name: Cache Built Code
uses: actions/cache@v2
with:
Expand Down Expand Up @@ -102,6 +105,7 @@ jobs:
name: liquibase-mongodb
path: |
target/*.jar
pom.xml
integration-tests:
name: Java ${{ matrix.java }}
Expand Down Expand Up @@ -147,24 +151,12 @@ jobs:
tag_name: liquibase-mongodb-${{ needs.setup.outputs.extensionVersion }}
draft: true
body: Support for Liquibase ${{ needs.setup.outputs.liquibaseVersion }}.
files: liquibase-mongodb-*.jar
files: target/liquibase-mongodb-*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_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
uses: liquibase/build-logic/.github/workflows/[email protected]
secrets: inherit
17 changes: 15 additions & 2 deletions .github/workflows/release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,26 @@ jobs:
gpg-private-key: ${{ secrets.GPG_SECRET }}
gpg-passphrase: GPG_PASSPHRASE

- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.BOT_TOKEN}}
workflow: create-release.yml
name: liquibase-mongodb
check_artifacts: true
skip_unpack: false
if_no_artifact_found: fail
workflow_conclusion: ""

- name: Publish to the Maven Central Repository
run: mvn clean deploy -Dmaven.test.skip -P release
run: mvn deploy:deploy-file -Dfile=./target/${{ github.event.release.tag_name}}.jar -Dmaven.test.skip -DrepositoryId=sonatype-nexus-staging -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2-fail -DpomFile=pom.xml -P release
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}


deploy_xsd:
name: Upload xsds
runs-on: ubuntu-20.04
Expand All @@ -50,7 +63,6 @@ jobs:
# aws s3 sync syncs directories and S3 prefixes.
run: |
aws s3 sync liquibase-mongodb/src/main/resources/www.liquibase.org/xml/ns/mongodb/ s3://liquibaseorg-origin/xml/ns/mongodb/ --content-type application/octet-stream --only-show-errors
- name: Index.htm file upload
env:
AWS_ACCESS_KEY_ID: ${{ secrets.LIQUIBASEORIGIN_ACCESS_KEY_ID }}
Expand All @@ -70,4 +82,5 @@ jobs:
sed -ie "s/<\/ul>/ <li><a href=\"\/xml\/ns\/mongodb\/${entry}\">${entry}<\/a><\/li>\n<\/ul>/" index-file/index.htm
fi
done
aws s3 sync index-file s3://liquibaseorg-origin/xml/ns/mongodb/ --only-show-errors
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-mongodb</artifactId>
Expand All @@ -23,7 +22,7 @@
<url>https://github.com/liquibase/liquibase-mongodb/issues</url>
</issueManagement>
<scm>
<connection>scm:git:http://github.com/liquibase/liquibase-mongodb.git</connection>
<connection>scm:git:https://github.com/liquibase/liquibase-mongodb.git</connection>
<url>https://github.com/liquibase/liquibase-mongodb</url>
<tag>HEAD</tag>
</scm>
Expand Down

0 comments on commit 3c1896c

Please sign in to comment.