diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fceb61c9d..448204226 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,8 @@ jobs: env: # BUILD_SNAPSHOT: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && # (github.ref_name == 'develop' || startsWith(github.ref_name, 'release-')) }} - BUILD_SNAPSHOT: false + BUILD_SNAPSHOT: true + DEPLOY_MAVEN_CENTRAL: false steps: - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 with: @@ -47,11 +48,10 @@ jobs: java-version: 11 distribution: 'temurin' cache: 'maven' - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml server-username: MAVEN_USERNAME # env variable for username in deploy server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase + # gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import + # gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: Set up JDK 11 (build only) if: ${{ steps.setup-java-deploy.outcome == 'skipped' }} uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 @@ -67,17 +67,16 @@ jobs: # ------------------------- # Maven Build # ------------------------- - - id: build-test-deploy + - id: build-test-deploy-github name: Build, Test and DEPLOY SNAPSHOT Code if: ${{ env.BUILD_SNAPSHOT == 'true' }} run: | mvn -B -e -Pgpg -Prelease -Preporting deploy -Dmaven.deploy.skip=releases env: - MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - name: Build and Test Code - if: ${{ steps.build-test-deploy.outcome == 'skipped' }} + if: ${{ steps.build-test-deploy-github.outcome == 'skipped' }} run: | mvn -B -e -Prelease -Preporting install - name: Perform CodeQL Analysis @@ -89,3 +88,25 @@ jobs: run: | # this needs to be run as a second build to ensure source is fully generated by the previous step mvn -B -e -Prelease -Preporting install site site:stage + - id: setup-java-deploy-maven-central + name: Set up JDK 11 (deploy) + if: ${{ env.BUILD_SNAPSHOT == 'true' && env.DEPLOY_MAVEN_CENTRAL == 'true' }} + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 + with: + java-version: 11 + distribution: 'temurin' + cache: 'maven' + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase + - id: build-test-deploy-maven-central + name: Build, Test and DEPLOY SNAPSHOT Code + if: ${{ env.BUILD_SNAPSHOT == 'true' && env.DEPLOY_MAVEN_CENTRAL == 'true' }} + run: | + mvn -B -e -Pgpg -Prelease -Preporting deploy -Dmaven.deploy.skip=releases + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}