Repository navigation
Publish #8
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 | |
| # Releases to Maven Central through the Central Portal. Push the tag v<version> (matching pom.xml) | |
| # or run manually. Re-running is safe: a version that is already published is not uploaded again. | |
| on: | |
| push: | |
| tags: ["v*"] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag to release, for example v0.1.0 (default: the selected ref)" | |
| required: false | |
| type: string | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: publish-${{ inputs.tag || github.ref_name }} | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| name: Publish to Maven Central | |
| runs-on: ubuntu-latest | |
| environment: release | |
| timeout-minutes: 120 | |
| env: | |
| RELEASE_TAG: ${{ inputs.tag || (github.ref_type == 'tag' && github.ref_name || '') }} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ inputs.tag || github.ref }} | |
| - uses: jdx/mise-action@v5 | |
| - name: Check tag matches pom.xml version | |
| run: | | |
| version=$(sed -n 's:.*<version>\(.*\)</version>.*:\1:p' pom.xml | head -1) | |
| echo "pom.xml version: $version, tag: ${RELEASE_TAG:-<none>}" | |
| if [ -n "$RELEASE_TAG" ] && [ "$RELEASE_TAG" != "v$version" ]; then | |
| echo "::error::tag $RELEASE_TAG does not match pom.xml version $version" | |
| exit 1 | |
| fi | |
| - name: Full check (build, tests, conformance, javadoc, examples) | |
| run: mise run check | |
| - name: Upload, validate and publish | |
| run: mise exec -- node scripts/publish.mjs --publish | |
| env: | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| - name: Install from Maven Central into a clean project and run a smoke program | |
| run: mise exec -- node scripts/publish.mjs --verify-consumer |