Deploy Snapshot #48
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: Deploy Snapshot | |
| on: | |
| workflow_run: | |
| workflows: ["Build any branch"] | |
| types: [completed] | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| env: | |
| MAVEN_COMMAND: ./mvnw | |
| MAVEN_CLI_COMMON: "-e -B" | |
| concurrency: | |
| group: snapshot-deploy | |
| cancel-in-progress: false | |
| jobs: | |
| deploy-snapshot: | |
| if: github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| persist-credentials: false | |
| - uses: ./.github/actions/jdk-setup | |
| with: | |
| server-id: central-publish | |
| server-username: CENTRAL_USERNAME | |
| server-password: CENTRAL_TOKEN | |
| - name: Get project version | |
| id: ver | |
| run: echo "version=$(${{ env.MAVEN_COMMAND }} help:evaluate -Dexpression=project.version -q -DforceStdout | tail -1)" >> $GITHUB_OUTPUT | |
| - name: Deploy snapshot to Maven Central | |
| if: endsWith(steps.ver.outputs.version, '-SNAPSHOT') | |
| env: | |
| CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} | |
| CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }} | |
| run: ${{ env.MAVEN_COMMAND }} ${{ env.MAVEN_CLI_COMMON }} source:jar-no-fork deploy -DskipTests -Darchetype.test.skip=true | |
| - name: Skip (not a snapshot version) | |
| if: "!endsWith(steps.ver.outputs.version, '-SNAPSHOT')" | |
| run: echo "Version ${{ steps.ver.outputs.version }} is a release version — skipping snapshot deploy" |