269 字
1 分钟
搭建基于astro的静态博客
拉取仓库
git clone https://github.com/1143520/fuwari.git
安装 Node.js
安装依赖(管理员CMD)
npm install -g pnpm
然后
D:
cd D:\code\astro-fuwari\fuwari
pnpm install
本地预览
pnpm dev
上传仓库自动构建和vercel部署
首先排除依赖文件夹node_modules(太大),可以剪切或者ignore
上传之后
自动构建fuwari\.github\workflows\deploy.yml
name: Deploy to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm install
- name: Build site
run: pnpm build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4