add descriptions for full-build and deploy-release profiles in pom.xml #40
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: SNAPSHOT Publish | |
| on: | |
| push: | |
| branches: [ main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| # Generate a settings.xml with a <server id="central-portal-snapshots"> | |
| # whose credentials come from the env vars below. The id must match | |
| # <snapshotRepository><id> in pom.xml, so `mvn deploy` of a -SNAPSHOT | |
| # authenticates against the Central Portal snapshot repository. | |
| server-id: central-portal-snapshots | |
| server-username: MAVEN_CENTRAL_USERNAME | |
| server-password: MAVEN_CENTRAL_PASSWORD | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: maven-${{ hashFiles('pom.xml') }} | |
| restore-keys: maven- | |
| - name: Check this is a SNAPSHOT version | |
| # release.sh briefly pushes a release-version commit ("Version X.Y.Z") to | |
| # main before bumping back to the next -SNAPSHOT. That push also triggers | |
| # this workflow. We must NOT publish a release version to the snapshot repo, | |
| # so gate the deploy on the POM version ending in -SNAPSHOT. A non-SNAPSHOT | |
| # push is skipped cleanly (green), not failed. | |
| id: version | |
| run: | | |
| POM_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| if [[ "$POM_VERSION" == *-SNAPSHOT ]]; then | |
| echo "is_snapshot=true" >> "$GITHUB_OUTPUT" | |
| echo "POM version $POM_VERSION is a SNAPSHOT — will publish." | |
| else | |
| echo "is_snapshot=false" >> "$GITHUB_OUTPUT" | |
| echo "POM version $POM_VERSION is not a SNAPSHOT — skipping snapshot publish." | |
| fi | |
| - name: Publish SNAPSHOT to Central Portal | |
| # `deploy` runs the full lifecycle (incl. tests) and pushes the -SNAPSHOT | |
| # artifacts to the Central Portal snapshot repo configured in pom.xml. | |
| # No GPG signing is required for snapshots. | |
| if: steps.version.outputs.is_snapshot == 'true' | |
| # project.build.outputTimestamp pins every archive/manifest timestamp to | |
| # the commit's committer date (strict ISO-8601 via %cI), so the same | |
| # commit always builds byte-identical artifacts (reproducible builds), | |
| # independent of when or where the build runs. | |
| run: | | |
| BUILD_TS=$(git log -1 --format=%cI) | |
| echo "Pinning project.build.outputTimestamp to $BUILD_TS" | |
| ./mvnw -B -Pfull-build clean deploy -Dproject.build.outputTimestamp="$BUILD_TS" | |
| env: | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} |