Bump org.sonatype.central:central-publishing-maven-plugin (#457) #1
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: Maven Publish Snapshot | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true # Ensures submodules are checked out | |
| fetch-depth: 0 # Fetches the full history to avoid issues with submodules | |
| - name: Update git submodules | |
| run: git submodule update --init --recursive | |
| - name: Set up Java and Maven Central credentials | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| server-id: central | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
| - name: Build with Maven | |
| run: | | |
| mvn --batch-mode verify | |
| - name: Set env variables | |
| run: | | |
| echo "Exporting Variables" | |
| export version=$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q) | |
| echo "VERSION=${version}" >> $GITHUB_ENV | |
| - name: Deploy SNAPSHOTS | |
| if: ${{ endsWith(env.VERSION, '-SNAPSHOT') }} | |
| run: mvn --batch-mode deploy -P release -DskipTests | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }} | |
| MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |