From 575e58bc8ea748860e51ff23b41cdb9002591c63 Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Fri, 13 Sep 2024 11:01:14 +0200 Subject: [PATCH 1/3] ci: build as jobs + deploy to maven central --- .github/workflows/maven-build.yml | 62 ++++++++++++++++--------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 3e4da66..041bda2 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -13,25 +13,36 @@ jobs: COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN }} COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }} GITHUB_TOKEN: ${{ github.token }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} MARKDOWN2HTML_MAVEN_PLUGIN_FAIL_ON_ERROR: true steps: - - name: Checkout + - name: 📄 Checkout the repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + fetch-depth: 0 - name: Set up JDK and Maven - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: adopt java-version: 17 gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }} - - name: Prepare Cache + - name: 📝 Get the project version + id: project_version + run: echo "project_version=$(mvn help:evaluate -Dexpression=project.version + -q -DforceStdout)" >> $GITHUB_OUTPUT + - name: 📝 Store cache key + id: cache_key + run: echo "cache_key=${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}-${{ + github.sha }}" >> $GITHUB_OUTPUT + - name: 💾 Prepare cache using cache key id: prepare-cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: | /home/runner/.m2 /home/runner/work - key: ${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }} - - name: Generate settings.xml + key: ${{ steps.cache_key.outputs.cache_key }} + - name: 🔘 Generate settings.xml for Maven uses: whelk-io/maven-settings-xml-action@9dc09b23833fa9aa7f27b63db287951856f3433d # v22 with: repositories: > @@ -78,23 +89,15 @@ jobs: } } ] - - name: Print settings.xml + - name: 🔘 Print settings.xml run: cat /home/runner/.m2/settings.xml - - name: Build with Maven - run: mvn --batch-mode clean package - - name: Store project version - id: project_version - run: echo "project_version=$(mvn help:evaluate -Dexpression=project.version - -q -DforceStdout)" >> $GITHUB_OUTPUT - - name: Store cache key - id: cache_key - run: echo "cache_key=${{ runner.os }}-mvn-${{ hashFiles('**/pom.xml') }}" - >> $GITHUB_OUTPUT + - name: 📦 Build with Maven + run: mvn --batch-mode clean package # sonar:sonar outputs: project_version: ${{ steps.project_version.outputs.project_version }} cache_key: ${{ steps.cache_key.outputs.cache_key }} - # deploy to Maven Central + # Deploy release to Maven Central deploy-maven-central: needs: build runs-on: ubuntu-latest @@ -106,13 +109,13 @@ jobs: COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_TOKEN }} COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PASSPHRASE }} steps: - - name: Set up JDK and Maven - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + - name: 🧱 Set up JDK and Maven + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: adopt java-version: 17 gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }} - - name: Restore Cache + - name: 💾 Restore cache using cache key id: restore-cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: @@ -120,7 +123,7 @@ jobs: /home/runner/.m2 /home/runner/work key: ${{ needs.build.outputs.cache_key }} - - name: Publish to Maven Central + - name: 📦 Deploy artifacts to Maven Central run: mvn --batch-mode -Dmaven.test.skip=true deploy -P gpg-sign -P nexus-staging # deploy to GitHub Packages @@ -136,23 +139,22 @@ jobs: S3_SBB_POLARION_MAVEN_REPO_RW_SECRET_ACCESS_KEY: ${{ secrets.S3_SBB_POLARION_MAVEN_REPO_RW_SECRET_ACCESS_KEY }} GITHUB_TOKEN: ${{ github.token }} steps: - - name: Set up JDK and Maven - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + - name: 🧱 Set up JDK and Maven + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: adopt java-version: 17 - - name: Cache - id: cache + - name: 💾 Restore cache using cache key + id: restore-cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 with: path: | /home/runner/.m2 /home/runner/work key: ${{ needs.build.outputs.cache_key }} - - name: Publish to GitHub Packages + - name: 📦 Deploy artifacts to GitHub Packages run: mvn --batch-mode -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true deploy -P deploy-github-packages - - name: Upload assets - run: cd ${{github.workspace}} && gh release upload v${{ needs.build.outputs.project_version }} - target/*-${{ needs.build.outputs.project_version }}.jar - shell: bash + - name: 📦 Upload assets to GitHub Release + run: |- + gh release upload v${{ needs.build.outputs.project_version }} target/*-${{ needs.build.outputs.project_version }}.jar From 0d93e2c9ace3c1a22fdf43a9062b99ff296b0562 Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Fri, 13 Sep 2024 11:07:16 +0200 Subject: [PATCH 2/3] ci: build as jobs + deploy to maven central --- pom.xml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pom.xml b/pom.xml index 5522a2e..05a0f1a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,6 +6,10 @@ html5diff 1.4.3-SNAPSHOT + HTML5Diff + Visual comparison of HTML in Java. Fork of DaisyDiff/DaisyDiff + https://github.com/SchweizerischeBundesbahnen/html5diff + Apache License Version 2.0, January 2004 @@ -13,6 +17,26 @@ + + + SBB Polarion Team + polarion-opensource@sbb.ch + SBB AG + https://www.sbb.ch + + + + + scm:git:git://github.com/SchweizerischeBundesbahnen/html5diff.git + scm:git:ssh://github.com/SchweizerischeBundesbahnen/html5diff.git + https://github.com/SchweizerischeBundesbahnen/html5diff/tree/main + + + + GitHub + https://github.com/SchweizerischeBundesbahnen/html5diff/issues + + UTF-8 From f1d10213017ca71f4843ae1ab0c4cc3c221997b1 Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Fri, 13 Sep 2024 11:12:24 +0200 Subject: [PATCH 3/3] ci: build as jobs + deploy to maven central --- pom.xml | 67 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 05a0f1a..1dad0fa 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,11 @@ UTF-8 + + 3.2.5 + + 1.7.0 + true @@ -90,20 +95,29 @@ + - repsyDeploy - - - repsy - repsy.io - https://repo.repsy.io/mvn/sbb/sbb - - - repsy - repsy.io - https://repo.repsy.io/mvn/sbb/sbb - - + gpg-sign + + + + org.apache.maven.plugins + maven-gpg-plugin + + + + + + + nexus-staging + + + + org.sonatype.plugins + nexus-staging-maven-plugin + + + @@ -130,6 +144,33 @@ maven-jar-plugin 3.4.2 + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + + sign-artifacts + verify + + sign + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + ${nexus-staging-maven-plugin.version} + true + + ossrh + https://oss.sonatype.org/ + ${nexus-staging-maven-plugin.autoReleaseAfterClose} + +