add(redirect): how to #2630
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: Build and publish doc | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # required for git date plugin | |
- name: Create cached folder | |
uses: actions/cache@v4 | |
with: | |
path: out | |
key: ${{ github.sha }} | |
- 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: Build documentation | |
run: | | |
./build.sh nav ssb test-nais ci-nais dev-nais tenant | |
publish: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
tenant: | |
- name: ci-nais | |
bucket: doc.ci-nais.cloud.nais.io | |
- name: dev-nais | |
bucket: doc.dev-nais.cloud.nais.io | |
- name: nav | |
bucket: doc.nav.cloud.nais.io | |
- name: nav | |
bucket: docs.nais.io | |
- name: ssb | |
bucket: doc.ssb.cloud.nais.io | |
- name: test-nais | |
bucket: doc.test-nais.cloud.nais.io | |
steps: | |
- name: Restore cache folder | |
uses: actions/cache/restore@v4 | |
with: | |
path: out | |
key: ${{ github.sha }} | |
- name: Sync documentation to bucket | |
uses: actions-hub/[email protected] | |
env: | |
PROJECT_ID: not-used | |
APPLICATION_CREDENTIALS: ${{ secrets.NAIS_DOC_SA }} | |
with: | |
args: -m rsync -r -c -d out/${{matrix.tenant.name}}/ gs://${{ matrix.tenant.bucket }} | |
cli: gsutil | |
- name: Invalidate cache | |
uses: actions-hub/[email protected] | |
env: | |
PROJECT_ID: not-used | |
APPLICATION_CREDENTIALS: ${{ secrets.NAIS_DOC_SA }} | |
with: | |
args: -m setmeta -r -h 'Cache-Control:public, max-age=180' 'gs://${{ matrix.tenant.bucket }}/*' | |
cli: gsutil |