-
Notifications
You must be signed in to change notification settings - Fork 260
83 lines (71 loc) · 2.37 KB
/
deploy-docs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Build & Deploy Robusta Docs
on:
create: {}
release:
types: [published]
push:
paths:
- 'docs/**'
- .github/workflows/deploy-docs.yaml
jobs:
has-secrets:
name: Check Secrets
runs-on: ubuntu-latest
steps:
- id: docs
env:
HAS_SECRET_ACCESS: ${{ secrets.HAS_SECRET_ACCESS }}
if: ${{ env.HAS_SECRET_ACCESS != '' }}
run: echo '::set-output name=docs::true'
outputs:
docs: ${{ steps.docs.outputs.docs }}
setup-build-publish-deploy:
name: Deploy docs
runs-on: ubuntu-latest
needs: [has-secrets]
env:
PROJECT_ID: ${{ secrets.GKE_PROD_PROJECT }}
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: google-github-actions/[email protected]
if: needs.has-secrets.outputs.docs
with:
service_account_key: ${{ secrets.GKE_PROD_SA_KEY }}
project_id: ${{ secrets.GKE_PROD_PROJECT }}
export_default_credentials: true
# Configure Docker to use the gcloud command-line tool as a credential helper for authentication
- name: Configure Docker
if: needs.has-secrets.outputs.docs
run: |-
gcloud auth configure-docker us-central1-docker.pkg.dev
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get install graphviz pandoc
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0
poetry config virtualenvs.create false
poetry install --extras=all
# see https://stackoverflow.com/a/58034787/495995 for an explanation on ${GITHUB_REF##*/}
- name: Update docs version
run: |
echo "Setting DOCS_VERSION_PLACEHOLDER to ${GITHUB_REF##*/}"
sed -i "s/DOCS_VERSION_PLACEHOLDER/${GITHUB_REF##*/}/g" docs/conf.py
sed -i "s/DOCS_RELEASE_PLACEHOLDER/${GITHUB_REF##*/}/g" docs/conf.py
- name: Build the docs
env:
ROBUSTA_GOOGLE_FONTS_API_KEY: ${{ secrets.ROBUSTA_GOOGLE_FONTS_API_KEY }}
run: |
cd docs
poetry run make html
- name: Upload docs to public gcp bucket
if: needs.has-secrets.outputs.docs
run: gsutil rsync -R ./docs/_build/html "gs://robusta-docs/${GITHUB_REF##*/}/"
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build/html