Deploy UDR #458
This file contains hidden or 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: Deploy UDR | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'content/**' | |
| - 'app/**' | |
| workflow_dispatch: | |
| jobs: | |
| deploy-udr: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'hashicorp/web-unified-docs' | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_TEAM_ID }} # The org id for HashiCorp in Vercel | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} # The ID of the UDR Vercel project | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 | |
| with: | |
| cache: 'npm' | |
| node-version-file: 'package.json' | |
| - name: Use cache | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
| with: | |
| path: | | |
| ~/.npm | |
| ${{ github.workspace }}/.next/cache | |
| # Generate a new cache whenever packages or source files change. | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.mjs', '**/*.ts', '**/*.tsx', '**/*.mdx') }} | |
| # If source files changed but packages didn't, rebuild from a prior cache. | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
| - name: Install Vercel CLI | |
| run: npm install --global vercel@latest | |
| - name: Pull Vercel Environment Information | |
| run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Build Project Artifacts | |
| run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| - 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 }} |