fix script #8
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
# .github/workflows/deploy.yml | |
name: Deploy Nextra Site to GitHub Pages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
# Checkout the repository | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
# Install pnpm | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 10 | |
# Setup Node.js | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
with: | |
# Automatically inject basePath in your Next.js configuration file and disable | |
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). | |
# | |
# You may remove this line if you want to manage the configuration yourself. | |
static_site_generator: next | |
# 4. Restore Cache | |
- name: Restore Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.next/cache | |
~/.pnpm-store | |
key: ${{ runner.os }}-nextra-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**/*.js', '**/*.ts', '**/*.jsx', '**/*.tsx') }} | |
restore-keys: | | |
${{ runner.os }}-nextra- | |
# 5. Install Dependencies using pnpm | |
- name: Install Dependencies | |
run: pnpm install | |
# 6. Build the Site | |
- name: Build the Site | |
run: pnpm build | |
# 7. Add .nojekyll to Prevent Jekyll Processing | |
- name: Add .nojekyll | |
run: touch ./docs/.nojekyll | |
# 8. Upload the Build Artifact | |
- name: Upload Build Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./docs | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# 9. Deploy to GitHub Pages | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |