Skip to content

shorten the dapr quickstart #2553

shorten the dapr quickstart

shorten the dapr quickstart #2553

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*.*
jobs:
build:
name: Build Hugo Website
if: github.event.action != 'closed'
runs-on: ubuntu-latest
env:
GOVER: '^1.17'
TUTORIAL_PATH: './docs/content/user-guides/tutorials/'
CODE_ZIP_PATH: './docs/static/tutorial/'
HUGO_ENV: production
SWA_BASE: 'wonderful-plant-020417a1e'
steps:
- name: Checkout docs repo
uses: actions/checkout@v3
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@v3
with:
repository: project-radius/radius
ref: ${{ env.RELEASE_BRANCH }}
path: ./radius
token: ${{ secrets.GH_RAD_CI_BOT_PAT }}
- name: Setup Go ${{ env.GOVER }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GOVER }}
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Setup Hugo
uses: peaceiris/[email protected]
with:
hugo-version: 0.102.3
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: Restore CLI Docs Cache
uses: actions/cache@v3
id: cli_cache
with:
path: |
./docs/content/reference/cli
key: ${{ runner.os }}-cli-${{ hashFiles('radius/pkg/cli') }}
- name: Restore Go Modules Cache
uses: actions/cache@v3
if: steps.cli_cache.outputs.cache-hit != 'true'
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('radius/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Generate CLI Docs
run: |
if [ ! -f ./docs/content/reference/cli/rad.md ]; then
cd radius
go run ./cmd/docgen/main.go ../docs/content/reference/cli
fi
- name: Generate Swagger docs
run : |
mkdir -p ./docs/static/swagger
cp -r ./radius/swagger ./docs/static/
- name: Build Hugo Site
run: |
cd docs
if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then
STAGING_URL="https://${SWA_BASE}-${{github.event.number}}.westus2.azurestaticapps.net/"
fi
hugo ${STAGING_URL+-b "$STAGING_URL"}
- name: Upload Hugo artifacts
uses: actions/upload-artifact@v3
with:
name: hugo_build
path: ./docs/public/
if-no-files-found: error
deploy:
name: Deploy Hugo Website
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: ['build']
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name == 'edge' && 'edge' || 'latest' }}
url: ${{ github.ref_name == 'edge' && 'https://edge.docs.radapp.dev' || 'https://docs.radapp.dev' }}
steps:
- name: Checkout docs repo
uses: actions/checkout@v3
with:
submodules: false
- name: Download Hugo artifacts
uses: actions/download-artifact@v3
with:
name: hugo_build
path: site/
- name: az CLI login
run: |
az login --service-principal \
--username ${{ secrets.AZURE_SP_TESTS_APPID }} \
--password ${{ secrets.AZURE_SP_TESTS_PASSWORD }} \
--tenant ${{ secrets.AZURE_SP_TESTS_TENANTID }}
- name: Deploy to WebApp
uses: Azure/webapps-deploy@v2
with:
app-name: ${{ vars.ENV_APPSERVICE_NAME }}
resource-group-name: ${{ vars.ENV_APPSERVICE_RESOURCEGROUP }}
package: site/
open_staging_site:
name: Open Staging Site
needs: ['build']
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Download Hugo artifacts
uses: actions/download-artifact@v3
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.STAGING_DOCS_SITE_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "site/"
api_location: "site/"
output_location: ""
skip_app_build: true
- name: Find SWA Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: 'Azure Static Web Apps:'
direction: last
- name: Update SWA Comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
**Password**: `Radiu$1234`
close_pr_site:
name: Close PR Staging Site
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.STAGING_DOCS_SITE_TOKEN }}
action: "close"
algolia_index:
name: Index site for Algolia
if: github.event_name == 'push'
needs: ['build', 'deploy']
runs-on: ubuntu-latest
environment:
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@v2
with:
submodules: false
- name: Download Hugo artifacts
uses: actions/download-artifact@v3
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