From a2f17d4f151169ef1bce6674172a04ce3d22d01e Mon Sep 17 00:00:00 2001 From: Ruben Nic Date: Fri, 21 Nov 2025 10:29:29 -0500 Subject: [PATCH] Simplify dev-portal redeployment --- .github/actions/reload-dev-portal/action.yml | 86 ------------------- .github/workflows/deploy-udr.yml | 13 ++- .../workflows/force-rebuild-dev-portal.yml | 14 +++ .github/workflows/force-reload-dev-portal.yml | 34 -------- 4 files changed, 19 insertions(+), 128 deletions(-) delete mode 100644 .github/actions/reload-dev-portal/action.yml create mode 100644 .github/workflows/force-rebuild-dev-portal.yml delete mode 100644 .github/workflows/force-reload-dev-portal.yml diff --git a/.github/actions/reload-dev-portal/action.yml b/.github/actions/reload-dev-portal/action.yml deleted file mode 100644 index 3f52a7133c..0000000000 --- a/.github/actions/reload-dev-portal/action.yml +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: BUSL-1.1 - -name: Re-load dev portal -description: 'Re-load dev portal for changed files' -inputs: - base_sha: - description: 'Base SHA for changed files comparison' - required: true - type: string - head_sha: - description: 'Head SHA for changed files comparison' - required: true - type: string - dev-portal-deploy-hook-prod: - description: 'Dev portal deploy hook token' - required: true - type: string - revalidate-token: - description: 'Revalidate token' - required: true - type: string - bot-bypass-token: - description: 'Bot bypass token' - required: true - type: string - -runs: - using: "composite" - steps: - - name: Get changed files in the content/ subdirectories - id: changed-files - uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7 - with: - files: | - content/**/*.mdx - base_sha: ${{ inputs.base_sha }} - sha: ${{ inputs.head_sha }} - - - name: Print changed files - shell: bash - run: | - echo "Changed files:" - echo ${{ steps.changed-files.outputs.all_changed_files }} | xargs -n 1 - - - name: - if: steps.changed-files.outputs.all_changed_files == '' - shell: bash - run: | - echo "No changed files found, redeploying dev-portal in case of api changes" - curl -X POST ${{ inputs.dev-portal-deploy-hook-prod }} - - - name: - if: steps.changed-files.outputs.all_changed_files_count >= 128 - shell: bash - run: | - echo "More than 124 paths changed, redeploying dev-portal" - curl -X POST ${{ inputs.dev-portal-deploy-hook-prod }} - - - name: Map files to URLs - id: map-files - if: steps.changed-files.outputs.all_changed_files_count < 128 - shell: bash - run: | - FILES_URLS=$(node ./scripts/map-files-to-urls.mjs ${{ steps.changed-files.outputs.all_changed_files }}) - echo "FILES_URLS=$FILES_URLS" >> $GITHUB_OUTPUT - - - name: Print urls - if: steps.changed-files.outputs.all_changed_files_count < 128 - shell: bash - run: echo ${{ steps.map-files.outputs.FILES_URLS }} | xargs -n 1 - - - name: Revalidate paths - if: steps.changed-files.outputs.all_changed_files_count < 128 - id: revalidate-paths - shell: bash - env: - url: 'https://developer.hashicorp.com/api/revalidate/paths' - auth: 'Authorization: Bearer ${{ inputs.revalidate-token }}' - bot-bypass: '${{ inputs.bot-bypass-token }}' - run: | - curl -X POST "${{ env.url }}" \ - -H "${{ env.auth }}" \ - -H "Content-Type: application/json" \ - -H "X-BOT-BYPASS: ${{ env.bot-bypass }}" \ - -d '{"paths": ${{ steps.map-files.outputs.FILES_URLS }} }' diff --git a/.github/workflows/deploy-udr.yml b/.github/workflows/deploy-udr.yml index e4dbc4c45f..f5ebdf0a0b 100644 --- a/.github/workflows/deploy-udr.yml +++ b/.github/workflows/deploy-udr.yml @@ -51,11 +51,8 @@ jobs: - name: Deploy Project Artifacts to Vercel run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} --logs --archive=tgz - - name: Reload dev portal on changed files - uses: ./.github/actions/reload-dev-portal - with: - base_sha: ${{ github.event.before }} - head_sha: ${{ github.event.after }} - dev-portal-deploy-hook-prod: ${{ secrets.DEV_PORTAL_DEPLOY_HOOK_PROD }} - revalidate-token: ${{ secrets.REVALIDATE_TOKEN }} - bot-bypass-token: ${{ secrets.DEVELOPER_BOT_BYPASS_TOKEN }} + - name: Rebuild Dev Portal + shell: bash + run: | + echo "Rebuilding all of dev-portal" + curl -X POST ${{ secrets.DEV_PORTAL_DEPLOY_HOOK_PROD }} diff --git a/.github/workflows/force-rebuild-dev-portal.yml b/.github/workflows/force-rebuild-dev-portal.yml new file mode 100644 index 0000000000..9cf69d7a28 --- /dev/null +++ b/.github/workflows/force-rebuild-dev-portal.yml @@ -0,0 +1,14 @@ +name: Force Rebuild Dev Portal + +on: + workflow_dispatch: + +jobs: + rebuild-dev-portal: + runs-on: ubuntu-latest + steps: + - name: Rebuild Dev Portal + shell: bash + run: | + echo "Rebuilding all of dev-portal" + curl -X POST ${{ secrets.DEV_PORTAL_DEPLOY_HOOK_PROD }} diff --git a/.github/workflows/force-reload-dev-portal.yml b/.github/workflows/force-reload-dev-portal.yml deleted file mode 100644 index 42575f169a..0000000000 --- a/.github/workflows/force-reload-dev-portal.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Force Reload Dev Portal - -on: - workflow_dispatch: - inputs: - base_sha: - description: 'Base SHA for changed files comparison' - required: true - type: string - head_sha: - description: 'Head SHA for changed files comparison' - required: true - type: string - -jobs: - re-load-dev-portal: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Install dependencies - run: npm install - - - name: Run prebuild script - run: npm run prebuild - - - name: Reload dev portal - uses: ./.github/actions/reload-dev-portal - with: - base_sha: ${{ inputs.base_sha }} - head_sha: ${{ inputs.head_sha }} - dev-portal-deploy-hook-prod: ${{ secrets.DEV_PORTAL_DEPLOY_HOOK_PROD }} - revalidate-token: ${{ secrets.REVALIDATE_TOKEN }} - bot-bypass-token: ${{ secrets.DEVELOPER_BOT_BYPASS_TOKEN }}