nightly-docs #938
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-docs | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * *' | |
jobs: | |
build-docs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
path: geomesa.github.io | |
- name: Checkout GeoMesa source | |
uses: actions/checkout@v4 | |
with: | |
repository: locationtech/geomesa | |
path: geomesa | |
- name: Check for doc updates | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd geomesa | |
GM="$(git log -1 --format=%at)" | |
cd ../geomesa.github.io | |
DOCS="$(git log -1 --format=%at documentation/latest)" | |
if [[ $DOCS -gt $GM ]]; then | |
gh run cancel ${{ github.run_id }} | |
gh run watch ${{ github.run_id }} | |
fi | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./geomesa/docs/requirements.txt | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
cache: 'maven' | |
- name: Build docs | |
working-directory: ./geomesa | |
run: mvn clean install -Pdocs -pl docs | |
- name: Copy docs | |
run: | | |
rm -r ./geomesa.github.io/documentation/latest/* | |
cp -r ./geomesa/docs/target/html/* ./geomesa.github.io/documentation/latest/ | |
- name: Build site | |
working-directory: ./geomesa | |
run: | | |
mvn clean package scoverage:integration-test site -Pscoverage && \ | |
mvn site:stage -DstagingDirectory="$(pwd)/site/" | |
- name: Copy site | |
run: cp -r ./geomesa/site/ ./geomesa.github.io/documentation/latest/ | |
- name: Commit nightly docs | |
working-directory: ./geomesa.github.io | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add --all ./documentation/latest/ | |
if [[ -n $(git status --porcelain) ]]; then | |
git commit -am "Nightly builds for $(date '+%Y-%m-%d %H:%M')" && git push | |
elif [[ $(git log -1 --format=%cd --date=relative) = '8 weeks ago' ]]; then | |
# add a no-op commit to keep this github action from being disabled | |
echo "" >> ./documentation/latest/index.html | |
git add ./documentation/latest/index.html | |
git commit -am "Nightly builds for $(date '+%Y-%m-%d %H:%M')" && git push | |
fi |