Docs-Deploy #4
This file contains 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
# Build and deploy the Docs Next.js site to GitHub Pages. | |
name: Docs-Deploy | |
on: | |
# Allows you to run this workflow manually from the Actions tab. | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow adding deployments. | |
permissions: | |
contents: read | |
deployments: write | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup Node | |
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 | |
with: | |
node-version: "20" | |
cache: npm | |
cache-dependency-path: docs/package-lock.json | |
- name: Restore cache | |
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
path: | | |
docs/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
- name: Install dependencies | |
working-directory: docs | |
run: npm install | |
- name: Build with @cloudflare/next-on-pages | |
working-directory: docs | |
run: npm run pages:build | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca # v1.5.0 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: 1d5774127406cf39ef881ff8d84f83c7 | |
projectName: kubeconfig-dart | |
directory: docs/.vercel/output/static | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
id: publish | |
- name: Outputs | |
run: | | |
echo "ID: ${{ steps.publish.outputs.id }}" | |
echo "URL: ${{ steps.publish.outputs.url }}" | |
echo "Environment: ${{ steps.publish.outputs.environment }}" | |
echo "Alias: ${{ steps.publish.outputs.alias }}" |