Add UI subpath info for EE #2536
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: | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
jobs: | |
staging-release: | |
permissions: | |
statuses: write | |
if: ${{ github.event_name != 'push' && github.repository_owner == 'weaveworks' && !github.event.pull_request.head.repo.fork }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: website | |
steps: | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | |
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | |
with: | |
node-version: "16.x" | |
- name: Build docs | |
env: | |
GA_KEY: "dummy" | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
GITHUB_HEAD_REF: ${{ github.head_ref }} | |
run: | | |
yarn install --frozen-lockfile | |
yarn clear | |
export DOC_BASE_URL="/$GITHUB_HEAD_REF/" | |
export DOC_URL=https://staging.docs.gitops.weave.works | |
export STAGING_BUILD=true | |
yarn build | |
- id: auth | |
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 # v1.1.1 | |
with: | |
credentials_json: ${{ secrets.PROD_DOCS_GITOPS_UPLOAD }} | |
- id: upload-file | |
uses: google-github-actions/upload-cloud-storage@e95a15f226403ed658d3e65f40205649f342ba2c # v1.0.3 | |
with: | |
path: website/build | |
destination: staging.docs.gitops.weave.works/${{ github.head_ref }} | |
parent: false | |
headers: |- | |
cache-control: no-cache | |
- id: add-docs-status | |
env: | |
GITHUB_HEAD_REF: ${{ github.head_ref }} | |
run: | | |
# Pull this out to a heredoc so we can easily interpolate variables | |
PAYLOAD=$(cat <<EOF | |
{ | |
"state": "success", | |
"context": "Doc site preview", | |
"target_url": "https://staging.docs.gitops.weave.works/$GITHUB_HEAD_REF" | |
} | |
EOF | |
) | |
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 "$PAYLOAD" \ | |
--fail | |
prod-release: | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: website | |
steps: | |
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 | |
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | |
with: | |
node-version: "16.x" | |
- name: Build docs | |
env: | |
GA_KEY: ${{ secrets.GA_KEY }} | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
run: | | |
yarn install --frozen-lockfile | |
yarn clear | |
yarn build | |
- id: auth | |
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 # v1.1.1 | |
with: | |
credentials_json: ${{ secrets.PROD_DOCS_GITOPS_UPLOAD }} | |
- id: upload-file | |
uses: google-github-actions/upload-cloud-storage@e95a15f226403ed658d3e65f40205649f342ba2c # v1.0.3 | |
with: | |
path: website/build | |
destination: production.docs.gitops.weave.works | |
parent: false |