Nightly Build #1
This file contains 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 CI Build and Snapshot Release | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
jobs: | |
verify_commit: | |
runs-on: ubuntu-latest | |
name: Verify latest commit | |
outputs: | |
RUN_BUILD: ${{ steps.verify_commit.outputs.RUN_BUILD }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: verify_commit | |
name: Verify latest commit is less than 24 hours | |
if: ${{ github.event_name == 'schedule' }} | |
run: echo '::set-output name=RUN_BUILD::'$(test -n "$(git log --format=%H --since='24 hours ago')" && echo 'true' || echo 'false') | |
build-natives: | |
name: Build native images | |
runs-on: ${{ matrix.os }} | |
needs: verify_commit | |
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '17.0.7' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
native-image-job-reports: 'true' | |
- name: Build native images with nativ maven plugin and extract in tar.gz | |
shell: bash | |
run: | | |
mvn -B -ntp -Pnative -DskipTests=true package | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: natives | |
path: cli/target/*.tar.gz | |
build: | |
name: Build Project and Deploy | |
needs: [build-natives, verify_commit] | |
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '17' | |
- uses: actions/download-artifact@v3 | |
- name: Make natives available and build project | |
run: | | |
mv ./natives/* ./cli/ | |
mvn -B -ntp -Dstyle.color=always install | |
- name: Deploy to OSSRH nexus | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dstyle.color=always -B -ntp deploy | |
cancel: | |
name: Cancel this workflow | |
runs-on: ubuntu-latest | |
needs: verify_commit | |
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'false' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
RUN_ID: ${{ github.run_id }} | |
steps: | |
- run: | | |
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/cancel" |