Maven Nightly Snapshot Build #78
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: Maven Nightly Snapshot Build | |
| on: | |
| # Run nightly at 2 AM UTC | |
| schedule: | |
| - cron: '0 2 * * *' | |
| issues: | |
| types: | |
| - closed | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # Get the default development branch (can change based on the milestone as needed) | |
| ref: ${{ github.event.repository.default_branch }} | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Set up Maven Central Repository | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| server-id: 'central' | |
| server-username: MAVEN_USERNAME | |
| server-password: MAVEN_PASSWORD | |
| - name: Get current date for snapshot naming | |
| id: date | |
| run: echo "date=$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT | |
| - name: Get branch name | |
| id: branch | |
| run: | | |
| BRANCH=${GITHUB_REF#refs/heads/} | |
| echo "branch=${BRANCH}" >> $GITHUB_OUTPUT | |
| echo "branch_safe=${BRANCH//\//-}" >> $GITHUB_OUTPUT | |
| - name: Get base version from pom | |
| id: version | |
| run: | | |
| BASE_VERSION=$(mvn help:evaluate -Dexpression=revision -q -DforceStdout) | |
| # Strip -SNAPSHOT if it exists and add -NIGHTLY-SNAPSHOT for stable reference | |
| CLEAN_VERSION=${BASE_VERSION%-SNAPSHOT} | |
| SNAPSHOT_VERSION="${CLEAN_VERSION}-NIGHTLY-SNAPSHOT" | |
| echo "snapshot_version=${SNAPSHOT_VERSION}" >> $GITHUB_OUTPUT | |
| echo "Maven snapshot version: ${SNAPSHOT_VERSION}" | |
| - name: Install gpg key and publish package | |
| run: | | |
| echo -e "Releasing ${{ steps.version.outputs.snapshot_version }}" | |
| echo -e "$(tty)" | |
| gpg --version | |
| mvn -version | |
| # This avoids gpg: signing failed: Inappropriate ioctl for device error | |
| # See https://github.com/keybase/keybase-issues/issues/2798 | |
| export GPG_TTY=$(tty) | |
| # export GPG_TTY=`tty` | |
| # https://gist.github.com/sualeh/ae78dc16123899d7942bc38baba5203c | |
| echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | gpg --batch --import | |
| gpg --list-secret-keys --keyid-format LONG | |
| mvn --batch-mode clean deploy -Drevision=${{ steps.version.outputs.snapshot_version }} -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} -DperformRelease=true | |
| env: | |
| MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
| MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} |