From d03f7dc03c81d80ec59ee0e15956409ed588e804 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 10:50:31 +0200 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=94=A7=20(create-release.yml):=20Upda?= =?UTF-8?q?te=20Maven=20version=20to=203.9.5=20for=20consistency=20and=20c?= =?UTF-8?q?ompatibility=20=F0=9F=94=A7=20(create-release.yml):=20Update=20?= =?UTF-8?q?sonar-push.yml=20workflow=20to=20use=20the=20main=20branch=20fo?= =?UTF-8?q?r=20better=20maintenance=20=F0=9F=94=A7=20(create-release.yml):?= =?UTF-8?q?=20Add=20support=20for=20setting=20up=20JDK=2017=20for=20the=20?= =?UTF-8?q?workflow=20=F0=9F=94=A7=20(create-release.yml):=20Add=20support?= =?UTF-8?q?=20for=20setting=20up=20Maven=20with=20the=20specified=20versio?= =?UTF-8?q?n=20=F0=9F=94=A7=20(create-release.yml):=20Add=20maven-settings?= =?UTF-8?q?-xml-action=20to=20configure=20repositories=20and=20servers=20f?= =?UTF-8?q?or=20Maven=20=F0=9F=94=A7=20(create-release.yml):=20Extract=20v?= =?UTF-8?q?ersion=20from=20pom.xml=20and=20set=20it=20as=20an=20environmen?= =?UTF-8?q?t=20variable=20for=20the=20workflow=20=F0=9F=94=A7=20(create-re?= =?UTF-8?q?lease.yml):=20Update=20Create=20Release=20step=20to=20use=20the?= =?UTF-8?q?=20extracted=20version=20for=20the=20release=20draft=20tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/create-release.yml | 74 +++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index dfd82202..7be0f164 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -9,9 +9,12 @@ on: default: '' type: string +env: + MAVEN_VERSION: "3.9.5" + jobs: sonar: - uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.7.8 + uses: liquibase/build-logic/.github/workflows/sonar-push.yml@main secrets: inherit with: extraCommand: ${{ inputs.extraCommand }} @@ -20,8 +23,77 @@ jobs: name: Create Release runs-on: ubuntu-latest steps: + + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: "temurin" + cache: "maven" + + - name: Set up Maven + uses: stCarolas/setup-maven@v4.5 + with: + maven-version: ${{ env.MAVEN_VERSION }} + + # look for dependencies in maven + - name: maven-settings-xml-action + uses: whelk-io/maven-settings-xml-action@v21 + with: + repositories: | + [ + { + "id": "liquibase", + "url": "https://maven.pkg.github.com/liquibase/liquibase", + "releases": { + "enabled": "true" + }, + "snapshots": { + "enabled": "true", + "updatePolicy": "always" + } + }, + { + "id": "liquibase-pro", + "url": "https://maven.pkg.github.com/liquibase/liquibase-pro", + "releases": { + "enabled": "true" + }, + "snapshots": { + "enabled": "true", + "updatePolicy": "always" + } + } + ] + servers: | + [ + { + "id": "liquibase-pro", + "username": "liquibot", + "password": "${{ secrets.LIQUIBOT_PAT }}" + }, + { + "id": "liquibase", + "username": "liquibot", + "password": "${{ secrets.LIQUIBOT_PAT }}" + } + ] + + - name: Extract version from pom.xml + id: extract_version + run: | + VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + VERSION=${VERSION%-SNAPSHOT} # Remove the -SNAPSHOT suffix if present + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Create Release Draft id: create-release uses: release-drafter/release-drafter@v5 + with: + tag: ${{ env.VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 8e7536550c35f6c7620bcd1fc04972e4d5ddc161 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 11:07:23 +0200 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=94=A7=20(extension-release-prepare.y?= =?UTF-8?q?ml):=20add=20pushChanges=3Dfalse=20flag=20to=20maven=20release?= =?UTF-8?q?=20prepare=20step=20to=20prevent=20automatic=20pushing=20of=20c?= =?UTF-8?q?hanges=20=F0=9F=94=A7=20(extension-release-prepare.yml):=20add?= =?UTF-8?q?=20git=20add=20and=20git=20commit=20commands=20to=20stage=20and?= =?UTF-8?q?=20commit=20changes=20made=20during=20maven=20release=20prepare?= =?UTF-8?q?=20step=20=F0=9F=94=A7=20(extension-release-published.yml):=20u?= =?UTF-8?q?pdate=20the=20version=20of=20the=20extension-release-prepare.ym?= =?UTF-8?q?l=20workflow=20to=20DAT-18309?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/extension-release-prepare.yml | 5 ++++- .github/workflows/extension-release-published.yml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extension-release-prepare.yml b/.github/workflows/extension-release-prepare.yml index 96e71d7b..c1617d7d 100644 --- a/.github/workflows/extension-release-prepare.yml +++ b/.github/workflows/extension-release-prepare.yml @@ -93,7 +93,10 @@ jobs: mvn -B build-helper:parse-version release:clean release:prepare \ -Darguments="-Dusername=liquibot -Dpassword=${{ secrets.BOT_TOKEN }} -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" \ -DdevelopmentVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion} \ - -DcheckModificationExcludeList=pom.xml + -DcheckModificationExcludeList=pom.xml -DpushChanges=false + git add **/pom.xml + git commit -m "[maven-release-plugin] prepare for next development iteration" + git push - name: Save Release files if: always() diff --git a/.github/workflows/extension-release-published.yml b/.github/workflows/extension-release-published.yml index f4366a79..2db6698b 100644 --- a/.github/workflows/extension-release-published.yml +++ b/.github/workflows/extension-release-published.yml @@ -28,7 +28,7 @@ on: jobs: maven-release: - uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@v0.7.8 + uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@DAT-18309 if: inputs.deployToMavenCentral == true secrets: inherit with: From ecfba3e7af15920736a7275ad4f56cea8e156de4 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 11:13:13 +0200 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=90=9B=20(extension-attach-artifact-r?= =?UTF-8?q?elease.yml):=20fix=20issue=20with=20updating=20release=20title?= =?UTF-8?q?=20and=20tag=20name=20in=20GitHub=20release=20API=20to=20match?= =?UTF-8?q?=20the=20project=20version.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/extension-attach-artifact-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/extension-attach-artifact-release.yml b/.github/workflows/extension-attach-artifact-release.yml index 633e806a..b0eb200a 100644 --- a/.github/workflows/extension-attach-artifact-release.yml +++ b/.github/workflows/extension-attach-artifact-release.yml @@ -191,7 +191,7 @@ jobs: version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) RELEASE_TITLE="v$version" echo "Updating release title to $RELEASE_TITLE" - curl -X PATCH -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" -d '{"name": "'"$RELEASE_TITLE"'"}' "https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}" + curl -X PATCH -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" -d '{"name": "'"$RELEASE_TITLE"'", "tag_name": "'"$version"'"}' "https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}" - name: Attach Files to Draft Release id: upload-release-asset From 33b132201c743f2f9e5fc2f2d36838e1346175f5 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 11:17:37 +0200 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=94=A7=20(create-release.yml):=20upda?= =?UTF-8?q?te=20liquibase/build-logic=20action=20to=20version=20v0.7.8=20f?= =?UTF-8?q?or=20sonar=20job=20=F0=9F=94=A7=20(extension-release-published.?= =?UTF-8?q?yml):=20change=20default=20value=20of=20deployToMavenCentral=20?= =?UTF-8?q?to=20boolean=20true?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/create-release.yml | 74 +------------------ .../workflows/extension-release-published.yml | 2 +- 2 files changed, 2 insertions(+), 74 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 7be0f164..dfd82202 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -9,12 +9,9 @@ on: default: '' type: string -env: - MAVEN_VERSION: "3.9.5" - jobs: sonar: - uses: liquibase/build-logic/.github/workflows/sonar-push.yml@main + uses: liquibase/build-logic/.github/workflows/sonar-push.yml@v0.7.8 secrets: inherit with: extraCommand: ${{ inputs.extraCommand }} @@ -23,77 +20,8 @@ jobs: name: Create Release runs-on: ubuntu-latest steps: - - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha || github.ref }} - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: "temurin" - cache: "maven" - - - name: Set up Maven - uses: stCarolas/setup-maven@v4.5 - with: - maven-version: ${{ env.MAVEN_VERSION }} - - # look for dependencies in maven - - name: maven-settings-xml-action - uses: whelk-io/maven-settings-xml-action@v21 - with: - repositories: | - [ - { - "id": "liquibase", - "url": "https://maven.pkg.github.com/liquibase/liquibase", - "releases": { - "enabled": "true" - }, - "snapshots": { - "enabled": "true", - "updatePolicy": "always" - } - }, - { - "id": "liquibase-pro", - "url": "https://maven.pkg.github.com/liquibase/liquibase-pro", - "releases": { - "enabled": "true" - }, - "snapshots": { - "enabled": "true", - "updatePolicy": "always" - } - } - ] - servers: | - [ - { - "id": "liquibase-pro", - "username": "liquibot", - "password": "${{ secrets.LIQUIBOT_PAT }}" - }, - { - "id": "liquibase", - "username": "liquibot", - "password": "${{ secrets.LIQUIBOT_PAT }}" - } - ] - - - name: Extract version from pom.xml - id: extract_version - run: | - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - VERSION=${VERSION%-SNAPSHOT} # Remove the -SNAPSHOT suffix if present - echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Create Release Draft id: create-release uses: release-drafter/release-drafter@v5 - with: - tag: ${{ env.VERSION }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/extension-release-published.yml b/.github/workflows/extension-release-published.yml index 2db6698b..72949db6 100644 --- a/.github/workflows/extension-release-published.yml +++ b/.github/workflows/extension-release-published.yml @@ -16,7 +16,7 @@ on: deployToMavenCentral: description: 'Specify it if you want to deploy to maven' required: false - default: 'true' + default: true type: boolean secrets: SONATYPE_USERNAME: From 2e4d40c5c0540589f12af27be82852eecd93d41b Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 11:24:40 +0200 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=94=A7=20(extension-release-prepare.y?= =?UTF-8?q?ml):=20update=20git=20add=20command=20to=20only=20add=20pom.xml?= =?UTF-8?q?=20file=20for=20commit=20to=20avoid=20adding=20unnecessary=20fi?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/extension-release-prepare.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/extension-release-prepare.yml b/.github/workflows/extension-release-prepare.yml index c1617d7d..6b2d2d28 100644 --- a/.github/workflows/extension-release-prepare.yml +++ b/.github/workflows/extension-release-prepare.yml @@ -94,7 +94,7 @@ jobs: -Darguments="-Dusername=liquibot -Dpassword=${{ secrets.BOT_TOKEN }} -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" \ -DdevelopmentVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion} \ -DcheckModificationExcludeList=pom.xml -DpushChanges=false - git add **/pom.xml + git add pom.xml git commit -m "[maven-release-plugin] prepare for next development iteration" git push From 008328504c3acdf0074832c980b1b2de70465f0e Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 11:43:43 +0200 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=94=A7=20(extension-release-prepare.y?= =?UTF-8?q?ml):=20fix=20issue=20with=20tagging=20during=20release=20prepar?= =?UTF-8?q?ation=20by=20deleting=20and=20force=20pushing=20the=20temporary?= =?UTF-8?q?=20tag=20to=20prevent=20conflicts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/extension-release-prepare.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/extension-release-prepare.yml b/.github/workflows/extension-release-prepare.yml index 6b2d2d28..788cef1f 100644 --- a/.github/workflows/extension-release-prepare.yml +++ b/.github/workflows/extension-release-prepare.yml @@ -93,10 +93,9 @@ jobs: mvn -B build-helper:parse-version release:clean release:prepare \ -Darguments="-Dusername=liquibot -Dpassword=${{ secrets.BOT_TOKEN }} -Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true -Dmaven.deploy.skip=true" \ -DdevelopmentVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion} \ - -DcheckModificationExcludeList=pom.xml -DpushChanges=false - git add pom.xml - git commit -m "[maven-release-plugin] prepare for next development iteration" - git push + -DcheckModificationExcludeList=pom.xml -DpushChanges=false -Dtag=temp + git tag -d temp + git push --force - name: Save Release files if: always() From 920cc3bda277d8c4e84ea4bf3ddc733473d2cf56 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 13:51:46 +0200 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=94=A7=20(.github/release-drafter.yml?= =?UTF-8?q?):=20Remove=20unnecessary=20Full=20Changelog=20link=20?= =?UTF-8?q?=F0=9F=94=A7=20(.github/workflows/extension-attach-artifact-rel?= =?UTF-8?q?ease.yml):=20Fix=20tag=5Fname=20value=20to=20include=20'v'=20pr?= =?UTF-8?q?efix=20before=20version=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/release-drafter.yml | 2 -- .github/workflows/extension-attach-artifact-release.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 1a61b3d9..7ac3e10c 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -51,5 +51,3 @@ template: | ## Changes $CHANGES - - **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$REPOSITORY-v$RESOLVED_VERSION diff --git a/.github/workflows/extension-attach-artifact-release.yml b/.github/workflows/extension-attach-artifact-release.yml index b0eb200a..4e480e64 100644 --- a/.github/workflows/extension-attach-artifact-release.yml +++ b/.github/workflows/extension-attach-artifact-release.yml @@ -191,7 +191,7 @@ jobs: version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) RELEASE_TITLE="v$version" echo "Updating release title to $RELEASE_TITLE" - curl -X PATCH -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" -d '{"name": "'"$RELEASE_TITLE"'", "tag_name": "'"$version"'"}' "https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}" + curl -X PATCH -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer ${{ secrets.BOT_TOKEN }}" -d '{"name": "'"$RELEASE_TITLE"'", "tag_name": "'"v$version"'"}' "https://api.github.com/repos/${{ github.repository }}/releases/${{ env.RELEASE_ID }}" - name: Attach Files to Draft Release id: upload-release-asset From e97d41d5799c364ba56bba84ff38785fd76fee01 Mon Sep 17 00:00:00 2001 From: Alejandro Alvarez Date: Fri, 2 Aug 2024 14:04:38 +0200 Subject: [PATCH 8/8] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20(extension-release-pub?= =?UTF-8?q?lished.yml):=20Update=20the=20reference=20to=20the=20extension-?= =?UTF-8?q?release-prepare.yml=20file=20to=20use=20the=20'main'=20branch?= =?UTF-8?q?=20instead=20of=20a=20specific=20branch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/extension-release-published.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/extension-release-published.yml b/.github/workflows/extension-release-published.yml index 72949db6..7e402dc3 100644 --- a/.github/workflows/extension-release-published.yml +++ b/.github/workflows/extension-release-published.yml @@ -28,7 +28,7 @@ on: jobs: maven-release: - uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@DAT-18309 + uses: liquibase/build-logic/.github/workflows/extension-release-prepare.yml@main if: inputs.deployToMavenCentral == true secrets: inherit with: