Skip to content

Maven Build and Deploy #4

Maven Build and Deploy

Maven Build and Deploy #4

Workflow file for this run

name: Maven Build and Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Unit Tests
run: mvn clean test
- name: Check Formatting
run: mvn spotless:check
deploy:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Set up Maven settings for GitHub Packages
run: |
mkdir -p ~/.m2
echo "<settings>
<servers>
<server>
<id>github</id>
<username>${{ secrets.MAVEN_USERNAME }}</username>
<password>${{ secrets.MAVEN_PASSWORD }}</password>
</server>
</servers>
</settings>" > ~/.m2/settings.xml
- name: Deploy with Maven
run: mvn deploy