Skip to content

nightly-docs

nightly-docs #1674

Workflow file for this run

name: nightly-docs
on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'
env:
MAVEN_CLI_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dtest.fork.count=1 --batch-mode
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
path: geomesa.github.io
sparse-checkout: |
documentation/latest
- name: Checkout GeoMesa source
uses: actions/checkout@v4
with:
repository: locationtech/geomesa
path: geomesa
- name: Configure git user
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '7715322+elahrvivaz@users.noreply.github.com'
- name: Check for doc updates
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd geomesa
git log -1 --format=%H > latest.commit
cd ../geomesa.github.io/
if [[ -z "$(diff ../geomesa/latest.commit ./documentation/latest/commit 2>&1)" ]]; then
if [[ $(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
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
# scoverage requires Java 17, even though we normally build with 11
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Build docs
working-directory: ./geomesa
run: mvn $MAVEN_CLI_OPTS 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/
mv ./geomesa/latest.commit ./geomesa.github.io/documentation/latest/commit
- name: Run scoverage
working-directory: ./geomesa
run: |
mvn clean install $MAVEN_CLI_OPTS -Pscoverage
# TODO get scoverage to run tests in geomesa-spark-tests module
- name: Build site
working-directory: ./geomesa
run: |
# set the correct site url
sed -i "s|<url>https://www.geomesa.org/</url>|<url>https://www.geomesa.org/documentation/latest/site/</url>|" pom.xml
mvn generate-sources site $MAVEN_CLI_OPTS -Psite
- name: Stage site
working-directory: ./geomesa
run: |
mvn site:stage $MAVEN_CLI_OPTS -DstagingDirectory="$PWD/../geomesa.github.io/documentation/latest/site/"
- name: Commit nightly docs
working-directory: ./geomesa.github.io
run: |
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
fi