Publish package to Netgrif Nexus #27
This file contains hidden or 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: Publish package to Netgrif Nexus | |
| on: workflow_dispatch | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Build | |
| run: mvn clean verify -DskipTests=true | |
| publish-OSSRH: | |
| runs-on: ubuntu-latest | |
| name: Publish to Netgrif Nexus | |
| needs: build | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: DEBUG PRINT | |
| run: echo "$MAVEN_USERNAME / $MAVEN_PASSWORD" | |
| shell: bash | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | |
| - name: Set up Maven Central Repository | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| server-id: netgrif-nexus-releases | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| - name: Publish package | |
| run: mvn -DskipTests=true --batch-mode -P netgrif-nexus-publish deploy | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | |