Skip to content

Revert "trigger docs build" #3645

Revert "trigger docs build"

Revert "trigger docs build" #3645

Workflow file for this run

name: Build & Deploy Robusta Docs
on:
create: {}
release:
types: [published]
push:
paths:
- 'docs/**'
- .github/workflows/deploy-docs.yaml
# we need this in addition to push to build the docs when the PR is opened and not just on later pushes after it is open
pull_request:
paths:
- 'docs/**'
types: [opened]
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:
# we do this before building the docs so that even if the docs fail building, we still have the comment on the PR for later once the build is fixed
# (we can't post the comment each time this workflow runs on we will have multiple comments, so we need to post it only once when the PR is opened)
- name: Post preview link on PR
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=$(echo ${{ github.event.pull_request.number }})
PREVIEW_URL="https://docs.robusta.dev/${GITHUB_HEAD_REF}"
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d "{\"body\": \"🔍 [Preview Docs](${PREVIEW_URL})\n\n**Note: preview docs will only be available at this URL once the initial docs finish building!**\"}" \
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
- name: Checkout
uses: actions/checkout@v2
- uses: google-github-actions/setup-gcloud@v0.2.0
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-public/${GITHUB_REF##*/}/"
- name: Upload docs artifact
uses: actions/upload-artifact@v2
with:
name: docs
path: docs/_build/html