Skip to content

Add sonar project config #23

Add sonar project config

Add sonar project config #23

name: Build and Publish Snapshot
on:
push:
branches:
- master
tags-ignore:
- '**'
paths-ignore:
- '**.md'
env:
MAVEN_OPTS: ${{ vars.MAVEN_OPTS }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
# - name: Cache Maven packages
# uses: actions/cache@v3
# with:
# path: ~/.m2
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
# restore-keys: ${{ runner.os }}-m2
- name: Prepare Maven settings.xml
run: |
cat "${{ github.workspace }}/.github/settings.xml" > ~/.m2/settings.xml
- name: Build with Maven
run: mvn --batch-mode --update-snapshots package
- name: Publish Snapshot to OSS SonaType
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
mvn --batch-mode --no-transfer-progress deploy \
-DskipTests \
-P oss-sonatype
- name: Notify on success
if: success()
run: |
echo "Snapshot has been successfully deployed to OSS SonaType."
- name: Notify on failure
if: failure()
run: |
echo "Snapshot deployment failed. Please check the logs for more information."