BAH-3807 | Add. Workflow to sign and deploy artifacts on push of a ta… #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish package | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
build-publish-package: | |
name: Build and Publish package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
server-id: nexus-sonatype | |
server-username: NEXUS_USERNAME | |
server-password: NEXUS_PASSWORD | |
- name: Build and deploy with Maven | |
run: | | |
PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) | |
if [[ "$PROJECT_VERSION" == *"-SNAPSHOT" ]]; then | |
./mvnw --no-transfer-progress clean -U deploy | |
else | |
echo "❌ The current push is for release. So skipping build." | |
fi | |
env: | |
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} |