Publish package to the Maven Central Repository #39
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 the Maven Central Repository | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for version detection | |
| - name: Set up Python (for version script) | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Update version files | |
| run: | | |
| python -m pip install setuptools-scm | |
| python scripts/update_versions.py | |
| - name: Set up Maven Central Repository | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: 11 | |
| distribution: 'temurin' | |
| server-id: ossrh | |
| server-username: MAVEN_USERNAME # Env var that holds your OSSRH user name | |
| server-password: MAVEN_PASSWORD # Env var that holds your OSSRH user pw | |
| gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Substituted with the value stored in the referenced secret | |
| gpg-passphrase: SIGN_KEY_PASS # Env var that holds the key's passphrase | |
| cache: 'maven' | |
| - name: Build & Deploy | |
| run: | | |
| # -U force updates just to make sure we are using latest dependencies | |
| # -B Batch mode (do not ask for user input), just in case | |
| # -P activate profile | |
| mvn -X -e -Prelease -DskipTests --batch-mode deploy | |
| env: | |
| SIGN_KEY_PASS: ${{ secrets.GPG_PASSPHRASE }} | |
| MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} |