Skip to content

Build and Publish

Build and Publish #149

Workflow file for this run

name: Build and Publish
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '0 0 * * *' # Daily build at midnight UTC
env:
JAVA_VERSION: '17'
MAVEN_VERSION: '3.9.5'
MAVEN_OPTS: '-Xmx3072m'
permissions:
contents: read
pages: write
id-token: write
actions: read
jobs:
build:
name: Build on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
- name: Build with Maven
run: mvn -B clean install
- name: Cache build artifacts
uses: actions/cache@v3
with:
path: |
~/.m2/repository
target/
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ matrix.os }}
path: target/
retention-days: 5
publish:
name: Generate and publish documentation
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.event_name == 'schedule') }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts-ubuntu-latest
path: target/
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.1'
- name: Install Jekyll dependencies
run: ./.run.jekyll.sh
- name: Setup GitHub Pages
uses: actions/configure-pages@v3
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./_site/
retention-days: 1
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
timeout: 600000 # 10-minute timeout