wip #2017
Workflow file for this run
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: CI | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
paths: | |
- .github/workflows/main.yml | |
- mkdocs.yml | |
- 'docs/**' | |
- 'custom_theme_overrides/**' | |
- pyproject.toml | |
- poetry.lock | |
env: | |
MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
architecture: x64 | |
cache: poetry | |
- name: Install all dependencies | |
run: | | |
poetry install \ | |
--no-dev \ | |
--no-interaction \ | |
--ansi \ | |
--remove-untracked | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Restore build cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: .cache | |
key: ${{ runner.os }}-build-cache-${{ steps.get-date.outputs.date }} | |
- name: Build documentation | |
run: | | |
poetry run mkdocs build --strict | |
- name: Save build cache | |
uses: actions/cache/save@v3 | |
with: | |
path: .cache | |
key: ${{ runner.os }}-build-cache-${{ steps.get-date.outputs.date }} | |
# Synchronize doctree with Google Cloud Bucket | |
- if: github.ref == 'refs/heads/main' | |
uses: actions-hub/[email protected] | |
env: | |
PROJECT_ID: aura-prod-d7e3 | |
APPLICATION_CREDENTIALS: ${{ secrets.GCP_SERVICEACCOUNT_KEY_FOR_DOC_NAIS_IO_BUCKET }} | |
with: | |
args: -m rsync -r -c -d site/ gs://doc.nais.io | |
cli: gsutil | |
# Cache buster | |
- if: github.ref == 'refs/heads/main' | |
uses: actions-hub/[email protected] | |
env: | |
PROJECT_ID: aura-prod-d7e3 | |
APPLICATION_CREDENTIALS: ${{ secrets.GCP_SERVICEACCOUNT_KEY_FOR_DOC_NAIS_IO_BUCKET }} | |
with: | |
args: -m setmeta -r -h 'Cache-Control:public, max-age=180' 'gs://doc.nais.io/*' | |
cli: gsutil |