Nightly Build #114
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: Nightly Build | |
| on: | |
| schedule: | |
| - cron: "20 4 * * *" | |
| permissions: | |
| contents: read | |
| jobs: | |
| snapshot_build: | |
| name: Nightly Snapshot | |
| environment: maven-central | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'schedule' | |
| permissions: | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "adopt" | |
| java-version: "11" | |
| - name: Cache Maven packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: ${{ runner.os }}-maven- | |
| - name: Validate pom.xml Version | |
| id: validate_pom_version | |
| run: | | |
| version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| mvn_run_type=install | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| if [[ $version == *"-SNAPSHOT" ]]; then | |
| echo -e "----####----\n VERSION IS SNAPSHOT: $version, DOING BUILD AND DEPLOY \n----####----" | |
| mvn_run_type=deploy | |
| fi | |
| echo "mvn_run_type=$mvn_run_type" >> $GITHUB_OUTPUT | |
| - name: Configure Maven settings | |
| run: | | |
| mkdir -p ~/.m2 | |
| cat <<EOF > ~/.m2/settings.xml | |
| <settings> | |
| <servers> | |
| <server> | |
| <id>central</id> | |
| <username>${{ secrets.USERNAME }}</username> | |
| <password>${{ secrets.PASSWORD }}</password> | |
| </server> | |
| </servers> | |
| </settings> | |
| EOF | |
| - name: Import GPG key | |
| env: | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| GPG_PUBLIC_KEY: ${{ vars.GPG_PUBLIC_KEY }} | |
| run: | | |
| echo "$GPG_PRIVATE_KEY" | gpg --batch --import | |
| echo "$GPG_PASSPHRASE" | gpg --batch --passphrase-fd 0 --pinentry-mode loopback --sign-key "$GPG_PUBLIC_KEY" | |
| echo "MAVEN_GPG_PASSPHRASE=${{ secrets.GPG_PASSPHRASE }}" >> $GITHUB_ENV | |
| - name: Build, Test and Deploy if Snapshot | |
| run: mvn -X clean ${{ steps.validate_pom_version.outputs.mvn_run_type }} |