From 52b369c25f665d12c89f1b6c12ec5497e9aa6008 Mon Sep 17 00:00:00 2001 From: Aaron Crawfis Date: Thu, 28 Sep 2023 10:25:34 -0700 Subject: [PATCH] Update SWA flow --- .github/workflows/website.yaml | 50 ++++++++++------------------------ 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index e23c8ced5..c5ba1670e 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -17,13 +17,14 @@ jobs: name: Build Hugo Website if: github.event.action != 'closed' runs-on: ubuntu-latest + environment: + name: ${{ github.ref_name == 'edge' && 'edge' || 'latest' }} 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 - SWA_BASE: 'wonderful-plant-020417a1e' steps: - name: Checkout docs repo uses: actions/checkout@v3 @@ -38,10 +39,6 @@ jobs: 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: @@ -58,29 +55,6 @@ jobs: 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 @@ -89,7 +63,8 @@ jobs: run: | cd docs if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then - STAGING_URL="https://${SWA_BASE}-${{github.event.number}}.westus2.azurestaticapps.net/" + STAGING_URL="https://${{ vars.ENV_STATICWEBAPP_BASE }}-${{github.event.number }}.3.azurestaticapps.net/" + calm-bush-0cc2a4f1e.3.azurestaticapps.net fi hugo ${STAGING_URL+-b "$STAGING_URL"} - name: Upload Hugo artifacts @@ -100,7 +75,7 @@ jobs: if-no-files-found: error deploy: - name: Deploy Hugo Website + name: Deploy Hugo Website to App Service if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' needs: ['build'] runs-on: ubuntu-latest @@ -131,11 +106,13 @@ jobs: resource-group-name: ${{ vars.ENV_APPSERVICE_RESOURCEGROUP }} package: site/ - open_staging_site: - name: Open Staging Site + deploy-website: + name: Deploy Hugo Website needs: ['build'] runs-on: ubuntu-latest - continue-on-error: true + environment: + name: ${{ github.ref_name == 'edge' && 'edge' || 'latest' }} + url: ${{ github.ref_name == 'edge' && 'https://edge.docs.radapp.dev' || 'https://docs.radapp.dev' }} steps: - name: Download Hugo artifacts uses: actions/download-artifact@v3 @@ -145,7 +122,7 @@ jobs: - name: Deploy staging site uses: Azure/static-web-apps-deploy@v1 with: - azure_static_web_apps_api_token: ${{ secrets.STAGING_DOCS_SITE_TOKEN }} + azure_static_web_apps_api_token: ${{ secrets.ENV_STATICWEBAPP_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: "upload" app_location: "site/" @@ -174,12 +151,15 @@ jobs: name: Close PR Staging Site if: github.event_name == 'pull_request' && github.event.action == 'closed' 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: Close Pull Request id: closepullrequest uses: Azure/static-web-apps-deploy@v1 with: - azure_static_web_apps_api_token: ${{ secrets.STAGING_DOCS_SITE_TOKEN }} + azure_static_web_apps_api_token: ${{ secrets.ENV_STATICWEBAPP_TOKEN }} action: "close" algolia_index: