ad docs and dashboard for indexer RED metrics #2015
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: Docs | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
paths: | |
- 'website/**' | |
push: | |
branches: | |
- 'main' | |
paths: | |
- 'website/**' | |
workflow_dispatch: | |
jobs: | |
staging-release: | |
permissions: | |
statuses: write | |
if: github.event_name != 'push' && github.repository_owner == 'weaveworks' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: website | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
- name: Test Build | |
env: | |
GA_KEY: "dummy" | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
run: | | |
if [ -e yarn.lock ]; then | |
yarn install --frozen-lockfile | |
elif [ -e package-lock.json ]; then | |
npm ci | |
else | |
npm i | |
fi | |
sed -i 's#url:.*$#url: "https://staging.docs.gitops.weave.works",#' docusaurus.config.js | |
sed -i 's#baseUrl:.*$#baseUrl: "/${{ github.head_ref }}/",#' docusaurus.config.js | |
yarn clear | |
npm run build | |
- id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.PROD_DOCS_GITOPS_UPLOAD }} | |
- id: upload-file | |
uses: google-github-actions/upload-cloud-storage@v1 | |
with: | |
path: website/build | |
destination: staging.docs.gitops.weave.works/${{ github.head_ref }} | |
parent: false | |
headers: |- | |
cache-control: no-cache | |
- id: add-docs-status | |
run: | | |
curl --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \ | |
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ | |
--header 'content-type: application/json' \ | |
--data '{ | |
"state": "success", | |
"context": "Doc site preview", | |
"target_url": "https://staging.docs.gitops.weave.works/${{ github.head_ref }}" | |
}' \ | |
--fail | |
prod-release: | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: website | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" | |
- uses: weaveworks/webfactory-ssh-agent@6b2f2c5354ff41f1edbbf7a17ea9b6178c89be9f | |
with: | |
ssh-private-key: ${{ secrets.WEAVE_GITOPS_DOCS_WEAVEWORKS_DOCS_BOT_DEPLOY_KEY }} | |
- name: Release to GitHub Pages | |
env: | |
USE_SSH: true | |
GIT_USER: git | |
GA_KEY: ${{ secrets.GA_KEY }} | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "weaveworks-docs-bot" | |
if [ -e yarn.lock ]; then | |
yarn install --frozen-lockfile | |
elif [ -e package-lock.json ]; then | |
npm ci | |
else | |
npm i | |
fi | |
yarn clear | |
npm run build | |
- id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.PROD_DOCS_GITOPS_UPLOAD }} | |
- id: upload-file | |
uses: google-github-actions/upload-cloud-storage@v1 | |
with: | |
path: website/build | |
destination: production.docs.gitops.weave.works | |
parent: false |