Skip to content

Clean up image files #2136

Clean up image files

Clean up image files #2136

Workflow file for this run

name: User's Guide
on:
push: # Build the docs for any branch (we only push to GCP when building from main)
pull_request: # Build the docs for any PR
create: # Any time a tag (or branch) is added, rebuild the docs.
jobs:
build-ug:
name: Sphinx docs
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
SLACK_API_TOKEN: ${{ secrets.SLACK_SW_INVEST_UG_WEBHOOK }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # so that setuptools_scm can get the right version string.
- name: Setup build environment with Micromamba
uses: mamba-org/setup-micromamba@v3
with:
environment-file: environment.yml
environment-name: env
condarc: |
channels:
- conda-forge
init-shell: bash
- name: install python requirements
run: pip install -r requirements.txt --no-build-isolation
- name: Build sphinx docs
run: make html
- name: Build redirects
run: make redirect
- name: Check links
# this has rarely run for hours for no apparent reason
timeout-minutes: 2
continue-on-error: true
run: make linkcheck
- name: Authenticate GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/auth@v3
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACC_KEY }}
- name: Set up GCP
if: github.event_name != 'pull_request'
uses: google-github-actions/setup-gcloud@v3
- name: Upload to release bucket
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
run: |
BUCKET=gs://releases.naturalcapitalproject.org/invest-userguide/latest
gcloud storage rsync -r --delete-unmatched-destination-objects build/html $BUCKET
# Cache appears to be reset each time we upload a new blob.
# Re-set the cache here to allow UG editors to immediately view
# changes to the rendered HTML.
gcloud storage objects update $BUCKET/** --cache-control="no-store" --recursive
- name: Upload to dev builds bucket
if: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/main' }}
run: |
FORKUSER=$(basename $(dirname $(git remote get-url origin)))
BUCKET=natcap-dev-build-artifacts/invest-userguide/$FORKUSER/latest
gcloud storage rsync -r --delete-unmatched-destination-objects build/html gs://$BUCKET
# Cache appears to be reset each time we upload a new blob.
# Re-set the cache here to allow UG editors to immediately view
# changes to the rendered HTML.
gcloud storage objects update $BUCKET/** --cache-control="no-store" --recursive
python .github/workflows/post_url_to_slack.py https://storage.googleapis.com/$BUCKET/en/index.html
- name: Save UG artifacts
uses: actions/upload-artifact@v4
with:
name: InVEST User's Guide
path: build/html