v1.2.0 #9
Workflow file for this run
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 Maven | |
| on: | |
| release: | |
| types: [published] | |
| 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' | |
| - uses: cardinalby/git-get-release-action@v1 | |
| id: getEnvRelease | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get Project Version from pom.xml | |
| uses: entimaniac/[email protected] | |
| id: getVersion | |
| - 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 -B -DskipTests=true clean verify | |
| publish-OSSRH: | |
| runs-on: ubuntu-latest | |
| name: Publish to Maven Central | |
| needs: build | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: install-secret-key | |
| name: Install gpg secret key | |
| run: | | |
| cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import | |
| gpg --list-secret-keys --keyid-format LONG | |
| - name: Set up Maven Central Repository | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: 'temurin' | |
| server-id: ossrh | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| - name: Publish package | |
| run: mvn -DskipTests=true --batch-mode -P ossrh-publish -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} deploy | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
| publish-artifact: | |
| name: GitHub Artifacts | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| server-id: github | |
| server-username: ${{ github.actor }} | |
| server-password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2 | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-m2 | |
| - name: Publish artifact on GitHub Packages | |
| run: mvn -B -P github-publish clean deploy -DskipTests | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-assets: | |
| name: Upload Release Assets | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Build | |
| run: mvn clean package install -DskipTests=true | |
| - name: Get Project Version from pom.xml | |
| uses: entimaniac/[email protected] | |
| id: getVersion | |
| - name: Build project | |
| run: | | |
| mkdir -p nae-module-maven-plugin-${{ steps.getVersion.outputs.version }} | |
| cp target/nae-module-maven-plugin-${{ steps.getVersion.outputs.version }}.jar nae-module-maven-plugin-${{ steps.getVersion.outputs.version }} | |
| cp target/plugin-enhanced.xml nae-module-maven-plugin-${{ steps.getVersion.outputs.version }} | |
| zip -r nae-module-maven-plugin-${{ steps.getVersion.outputs.version }}.zip nae-module-maven-plugin-${{ steps.getVersion.outputs.version }} | |
| - name: Upload binaries to release | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: nae-module-maven-plugin-${{ steps.getVersion.outputs.version }}.zip | |
| asset_name: nae-module-maven-plugin-${{ steps.getVersion.outputs.version }}.zip | |
| tag: ${{ github.ref }} | |
| overwrite: true |