Skip to content

增加友链:西邮 Wiki #41

增加友链:西邮 Wiki

增加友链:西邮 Wiki #41

Workflow file for this run

name: Build Site
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
# - name: node_modules CI Cache
# uses: actions/cache@v3
# with:
# path: ${{ github.workspace }}/node_modules
# key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
# - name: Next.js CI Cache
# uses: actions/cache@v3
# with:
# path: ${{ github.workspace }}/.next/cache
# # Generate a new cache whenever packages or source files change.
# key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**') }}
# # If source files changed but packages didn't, rebuild from a prior cache.
# restore-keys: |
# ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline
- name: Build Site
run: yarn build
env:
CDNJS_BASE_URL: https://cdnjs.baoshuo.ren/ajax/libs
- name: Upload Build Output to Artifacts
uses: actions/upload-pages-artifact@v3
with:
path: ${{ github.workspace }}/out/
retention-days: 30
deploy-gh-pages:
name: Deploy Site to GitHub Pages
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: [build]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
## Is this attempting to deploy a pull request as a GitHub Pages preview site?
## NOTE: This feature is only in alpha currently and is not available to the public!
preview: false # ${{ github.event_name != 'push' }}