|
| 1 | +# For more information see: |
| 2 | +# * https://docs.github.com/en/actions/learn-github-actions |
| 3 | +# * https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions |
| 4 | +# * https://github.com/actions/setup-java/blob/v3.13.0/docs/advanced-usage.md#Publishing-using-Apache-Maven |
| 5 | +# |
| 6 | + |
| 7 | +name: Deployment workflow |
| 8 | + |
| 9 | +on: |
| 10 | + release: |
| 11 | + types: [published] |
| 12 | + |
| 13 | +jobs: |
| 14 | + publish: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: read |
| 18 | + packages: write |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - name: Set up Java for publishing to Maven Central Repository |
| 22 | + uses: actions/setup-java@v3 |
| 23 | + with: |
| 24 | + # Use lowest supported LTS Java version |
| 25 | + java-version: '8' |
| 26 | + distribution: 'temurin' |
| 27 | + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml |
| 28 | + server-username: MAVEN_USERNAME # env variable for username in deploy |
| 29 | + server-password: MAVEN_PASSWORD # env variable for token in deploy |
| 30 | + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import |
| 31 | + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase |
| 32 | + |
| 33 | + - name: Publish to the Maven Central Repository |
| 34 | + run: mvn --batch-mode deploy |
| 35 | + env: |
| 36 | + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} |
| 37 | + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |
| 38 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} |
| 39 | + # - name: Set up Java for publishing to GitHub Packages |
| 40 | + # uses: actions/setup-java@v3 |
| 41 | + # with: |
| 42 | + # # Use lowest supported LTS Java version |
| 43 | + # java-version: '8' |
| 44 | + # distribution: 'temurin' |
| 45 | + # - name: Publish to GitHub Packages |
| 46 | + # run: mvn --batch-mode deploy |
| 47 | + # env: |
| 48 | + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments