Skip to content

try fix missing config #20

try fix missing config

try fix missing config #20

name: Docs Deploy to Vercel

Check failure on line 1 in .github/workflows/deploy-docs-vercel.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy-docs-vercel.yml

Invalid workflow file

(Line: 128, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.VERCEL_ALIAS != ''
on:
workflow_call:
inputs:
VERCEL_ENVIRONMENT:
type: string
required: true
description: "Vercel env to deploy to: 'production' or 'preview'."
DOCS_DIR:
type: string
required: true
default: "documentation"
description: "Path to the docs app root."
PREBUILT:
type: boolean
required: false
default: false
description: "If true, run 'vercel build' and deploy --prebuilt. Otherwise use remote build."
secrets:
VERCEL_TOKEN:
required: true
VERCEL_ORG_ID:
required: true
VERCEL_PROJECT_ID:
required: true
VERCEL_SCOPE:
required: true
VERCEL_ALIAS:
required: false
env:
VERCEL_ENVIRONMENT: ${{ inputs.VERCEL_ENVIRONMENT }}
DOCS_DIR: ${{ inputs.DOCS_DIR }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ inputs.DOCS_DIR }}
cancel-in-progress: ${{ inputs.VERCEL_ENVIRONMENT != 'production' }}
jobs:
vercel-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
pull-requests: write
issues: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4 pinned
with:
version: 9
- name: Install Vercel CLI
run: pnpm add --global vercel@latest
# Link project & pull env into ${DOCS_DIR}/.vercel/project.json
- name: Pull Vercel Environment Information
run: vercel pull \
--token="${{ secrets.VERCEL_TOKEN }}" \
--yes \
--environment="${{ inputs.VERCEL_ENVIRONMENT }}" \
--cwd "${DOCS_DIR}"
# Optional: install deps for lockfile consistency (harmless for remote builds)
- name: Install deps (docs)
run: pnpm install --frozen-lockfile
working-directory: ${{ env.DOCS_DIR }}
# --------- PREBUILT path (generates .vercel/output/*) ----------
- name: Build (prebuilt, preview)
if: ${{ inputs.PREBUILT && inputs.VERCEL_ENVIRONMENT == 'preview' }}
run: vercel build \
--token="${{ secrets.VERCEL_TOKEN }}" \
--target=preview \
--cwd "${DOCS_DIR}"
- name: Build (prebuilt, production)
if: ${{ inputs.PREBUILT && inputs.VERCEL_ENVIRONMENT == 'production' }}
run: vercel build \
--token="${{ secrets.VERCEL_TOKEN }}" \
--target=production \
--cwd "${DOCS_DIR}"
# --------- DEPLOY ----------
# Remote build (default): avoids routes-manifest checks locally
- name: Deploy (remote build, preview)
if: ${{ !inputs.PREBUILT && inputs.VERCEL_ENVIRONMENT == 'preview' }}
run: vercel deploy \
--token="${{ secrets.VERCEL_TOKEN }}" \
--scope="${{ secrets.VERCEL_SCOPE }}" \
--confirm \
--cwd "${DOCS_DIR}"
- name: Deploy (remote build, production)
if: ${{ !inputs.PREBUILT && inputs.VERCEL_ENVIRONMENT == 'production' }}
run: vercel deploy \
--prod \
--token="${{ secrets.VERCEL_TOKEN }}" \
--scope="${{ secrets.VERCEL_SCOPE }}" \
--confirm \
--cwd "${DOCS_DIR}"
# Prebuilt deploy (uses .vercel/output from the build steps)
- name: Deploy (prebuilt, preview)
if: ${{ inputs.PREBUILT && inputs.VERCEL_ENVIRONMENT == 'preview' }}
run: vercel deploy \
--prebuilt \
--token="${{ secrets.VERCEL_TOKEN }}" \
--scope="${{ secrets.VERCEL_SCOPE }}" \
--confirm \
--cwd "${DOCS_DIR}"
- name: Deploy (prebuilt, production)
if: ${{ inputs.PREBUILT && inputs.VERCEL_ENVIRONMENT == 'production' }}
run: vercel deploy \
--prebuilt \
--prod \
--token="${{ secrets.VERCEL_TOKEN }}" \
--scope="${{ secrets.VERCEL_SCOPE }}" \
--confirm \
--cwd "${DOCS_DIR}"
# Optional aliasing for production or preview
- name: Alias (optional)
if: ${{ secrets.VERCEL_ALIAS != '' }}
run: vercel alias set ${{ secrets.VERCEL_ALIAS }} \
--token="${{ secrets.VERCEL_TOKEN }}" \
--scope="${{ secrets.VERCEL_SCOPE }}"
working-directory: ${{ env.DOCS_DIR }}