Skip to content

Commit

Permalink
build: added skipTests option for manual start, added sonatype creds …
Browse files Browse the repository at this point in the history
…to deploy SNAPSHOT to maven central
  • Loading branch information
PeterPaul-Perfana committed Jul 2, 2024
1 parent 449057f commit 2470dda
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ on:
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
skipTests:
description: "Skip Tests?"
required: true
default: "no"

defaults:
run:
Expand All @@ -27,7 +32,7 @@ jobs:
run: |
echo "TAG_NAME=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
# if no tag exists, this is expected to fail
# only build SNAPSHOTS, use release for tagged releases
- name: Check if tag contains SNAPSHOT
if: contains(env.TAG_NAME, 'SNAPSHOT') != true
run: |
Expand All @@ -39,11 +44,20 @@ jobs:
with:
distribution: 'zulu'
java-version: 11
server-id: sonatype-nexus
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}

# push SNAPSHOT to maven central for testing
- name: Build
- name: Deploy SNAPSHOT to maven central
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSWORD }}
SKIP_TESTS: ${{ github.event.inputs.skipTests }}
run: |
./mvnw clean deploy
./mvnw --batch-mode $(if [ "$SKIP_TESTS" = "yes" ]; then echo "-DskipTests"; fi) clean deploy
- name: Upload jar
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit 2470dda

Please sign in to comment.