Skip to content

Commit bfd24c9

Browse files
Initial workflow try.
1 parent de18cc3 commit bfd24c9

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
env:
2727
# BUILD_SNAPSHOT: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') &&
2828
# (github.ref_name == 'develop' || startsWith(github.ref_name, 'release-')) }}
29-
BUILD_SNAPSHOT: false
29+
BUILD_SNAPSHOT: true
30+
DEPLOY_MAVEN_CENTRAL: false
3031
steps:
3132
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
3233
with:
@@ -47,11 +48,10 @@ jobs:
4748
java-version: 11
4849
distribution: 'temurin'
4950
cache: 'maven'
50-
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
5151
server-username: MAVEN_USERNAME # env variable for username in deploy
5252
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
53-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
54-
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
53+
# gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
54+
# gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
5555
- name: Set up JDK 11 (build only)
5656
if: ${{ steps.setup-java-deploy.outcome == 'skipped' }}
5757
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
@@ -67,17 +67,16 @@ jobs:
6767
# -------------------------
6868
# Maven Build
6969
# -------------------------
70-
- id: build-test-deploy
70+
- id: build-test-deploy-github
7171
name: Build, Test and DEPLOY SNAPSHOT Code
7272
if: ${{ env.BUILD_SNAPSHOT == 'true' }}
7373
run: |
7474
mvn -B -e -Pgpg -Prelease -Preporting deploy -Dmaven.deploy.skip=releases
7575
env:
76-
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
77-
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
78-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
# MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
7978
- name: Build and Test Code
80-
if: ${{ steps.build-test-deploy.outcome == 'skipped' }}
79+
if: ${{ steps.build-test-deploy-github.outcome == 'skipped' }}
8180
run: |
8281
mvn -B -e -Prelease -Preporting install
8382
- name: Perform CodeQL Analysis
@@ -89,3 +88,25 @@ jobs:
8988
run: |
9089
# this needs to be run as a second build to ensure source is fully generated by the previous step
9190
mvn -B -e -Prelease -Preporting install site site:stage
91+
- id: setup-java-deploy-maven-central
92+
name: Set up JDK 11 (deploy)
93+
if: ${{ env.BUILD_SNAPSHOT == 'true' && env.DEPLOY_MAVEN_CENTRAL == 'true' }}
94+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9
95+
with:
96+
java-version: 11
97+
distribution: 'temurin'
98+
cache: 'maven'
99+
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
100+
server-username: MAVEN_USERNAME # env variable for username in deploy
101+
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
102+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
103+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
104+
- id: build-test-deploy-maven-central
105+
name: Build, Test and DEPLOY SNAPSHOT Code
106+
if: ${{ env.BUILD_SNAPSHOT == 'true' && env.DEPLOY_MAVEN_CENTRAL == 'true' }}
107+
run: |
108+
mvn -B -e -Pgpg -Prelease -Preporting deploy -Dmaven.deploy.skip=releases
109+
env:
110+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
111+
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_TOKEN }}
112+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)