nightly-docs #1185
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: Configure git user | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
- 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 | |
- 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/ | |
mv ./geomesa/latest.commit ./geomesa.github.io/documentation/latest/commit | |
- name: Build site | |
working-directory: ./geomesa | |
run: | | |
mvn clean install scoverage:integration-test -Pscoverage -Dmaven.source.skip && \ | |
mvn generate-sources site && \ | |
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 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 |