Skip to content

Update auto-generated documentation #4973

Update auto-generated documentation

Update auto-generated documentation #4973

Workflow file for this run

name: Radius Website
on:
workflow_dispatch:
push:
branches:
- edge
- v*.*
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- edge
- v*.*
permissions:
id-token: write # Required for requesting the JWT
contents: read # Required for actions/checkout
jobs:
build:
name: Build Hugo Website
if: github.event.action != 'closed'
runs-on: ubuntu-latest
environment:
# If a PR into edge, use 'edge'. If a PR into anywhere else, use 'latest'. If a push, use the branch name.
name: ${{ github.event_name == 'pull_request' && (github.base_ref == 'edge' && 'edge' || 'latest') || github.ref_name }}
env:
GOVER: '^1.17'
TUTORIAL_PATH: './docs/content/user-guides/tutorials/'
CODE_ZIP_PATH: './docs/static/tutorial/'
HUGO_VERSION: 0.117.0
HUGO_ENV: production
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
with:
submodules: true
- name: Parse release version and set environment variables
run: python ./.github/scripts/get_docs_version.py
- name: Checkout radius repo
uses: actions/checkout@v4
with:
repository: radius-project/radius
ref: ${{ env.RELEASE_BRANCH }}
path: ./radius
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '14'
- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: ${{ env.HUGO_VERSION }}
extended: true
- name: Setup Docsy
run: |
cd docs
sudo npm install -D --save autoprefixer
sudo npm install -D --save postcss-cli
cd themes/docsy
npm install
- name: Generate Swagger docs
run : |
mkdir -p ./docs/static/swagger
cp -r ./radius/swagger ./docs/static/
- name: Override git_branch for PR
if: github.event_name == 'pull_request'
run: |
# Within docs/config.toml, replace the line that starts with "github_branch" with "github_branch: $GITHUB_HEAD_REF"
sed -i "s|github_branch = .*|github_branch = \"$GITHUB_HEAD_REF\"|" docs/config.toml
- name: Build Hugo Site
run: |
cd docs
if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then
STAGING_URL="https://${{ vars.ENV_STATICWEBAPP_BASE }}-${{github.event.number }}.westus2.3.azurestaticapps.net/"
fi
hugo ${STAGING_URL+-b "$STAGING_URL"}
- name: Upload Hugo artifacts
uses: actions/upload-artifact@v4
with:
name: hugo_build
path: ./docs/public/
if-no-files-found: error
deploy:
name: Deploy Hugo Website to App Service
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: ['build']
runs-on: ubuntu-latest
environment:
# If push to edge, use 'edge'. If push to anywhere else, use 'latest'.
name: ${{ github.ref_name == 'edge' && 'edge' || 'latest' }}
url: ${{ github.ref_name == 'edge' && 'https://edge.docs.radapp.io' || 'https://docs.radapp.io' }}
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
with:
submodules: false
- name: Download Hugo artifacts
uses: actions/download-artifact@v4
with:
name: hugo_build
path: site/
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_SP_TESTS_APPID }}
tenant-id: ${{ secrets.AZURE_SP_TESTS_TENANTID }}
subscription-id: ${{ vars.ENV_APPSERVICE_SUBSCRIPTIONID }}
- name: Deploy to WebApp
uses: Azure/webapps-deploy@v3
with:
app-name: ${{ vars.ENV_APPSERVICE_NAME }}
resource-group-name: ${{ vars.ENV_APPSERVICE_RESOURCEGROUP }}
package: site/
deploy-website:
name: Deploy Hugo Website
needs: ['build']
runs-on: ubuntu-latest
environment:
# If a PR or push into edge, use 'edge'. If a PR or push into anywhere else, use 'latest'.
name: ${{ github.event_name == 'pull_request' && (github.base_ref == 'edge' && 'edge' || 'latest') || (github.ref_name == 'edge' && 'edge' || 'latest') }}
# If a push to edge, use the edge URL. If a push to anywhere else, use the latest URL. If a PR, blank.
url: ${{ github.event_name == 'pull_request' && '' || (github.ref_name == 'edge' && 'https://edge.docs.radapp.io' || 'https://docs.radapp.io') }}
steps:
- name: Download Hugo artifacts
uses: actions/download-artifact@v4
with:
name: hugo_build
path: site/
- name: Deploy staging site
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.ENV_STATICWEBAPP_TOKEN }}
skip_deploy_on_missing_secrets: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "site/"
api_location: "site/"
output_location: ""
skip_app_build: true
close_pr_site:
name: Close PR Staging Site
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
environment:
# If a PR into edge, use 'edge'. If a PR into anywhere else, use 'latest'.
name: ${{ github.base_ref == 'edge' && 'edge' || 'latest' }}
url: ${{ github.base_ref == 'edge' && 'https://edge.docs.radapp.io' || 'https://docs.radapp.io' }}
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.ENV_STATICWEBAPP_TOKEN }}
skip_deploy_on_missing_secrets: true
action: "close"
algolia_index:
name: Index site for Algolia
if: github.event_name == 'push'
needs: ['build', 'deploy']
runs-on: ubuntu-latest
environment:
# If push to edge, use 'edge'. If push to anywhere else, use 'latest'.
name: ${{ github.ref_name == 'edge' && 'edge' || 'latest' }}
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_API_APPID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
ALGOLIA_INDEX_NAME: ${{ secrets.ENV_ALGOLIA_INDEXNAME }}
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
with:
submodules: false
- name: Download Hugo artifacts
uses: actions/download-artifact@v4
with:
name: hugo_build
path: site/
- name: Install Python packages
run: |
pip install --upgrade bs4
pip install --upgrade 'algoliasearch>=2.0,<3.0'
- name: Index site
run: python ./.github/scripts/algolia.py ./site