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: Java Maven Build & Publish Artifact | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Configure Maven settings | |
run: | | |
mkdir -p ~/.m2 | |
echo '<settings> | |
<servers> | |
<server> | |
<id>github</id> | |
<username>MBenincasa</username> | |
<password>${{ secrets.GITHUB_TOKEN }}</password> | |
</server> | |
</servers> | |
</settings>' > ~/.m2/settings.xml | |
- name: Build with Maven | |
run: mvn -B package -DskipTests --file pom.xml | |
- name: Publish to GitHub Packages Apache Maven | |
run: mvn deploy -DskipTests --file pom.xml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |