forked from saicaca/fuwari
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,23 +32,13 @@ jobs: | |
pnpm install # 安装依赖 | ||
pnpm run build # 构建 Astro 项目 | ||
# Step 5: 将静态文件推送到 gh-pages 分支 | ||
- name: Push to gh-pages branch | ||
run: | | ||
# 配置 Git 用户信息 | ||
git config --global user.name "GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
# 检查是否存在 gh-pages 分支,若没有则创建 | ||
git checkout gh-pages || git checkout --orphan gh-pages | ||
# 删除旧的静态文件并复制新的静态文件 | ||
rm -rf ./* | ||
# 确保 dist 文件夹存在并复制文件 | ||
cp -r ./dist/* ./ | ||
# 提交并推送更改 | ||
git add . | ||
git commit -m "Deploy new static files" | ||
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} gh-pages --force | ||
# Step 5: 将静态文件推送到云服务器 | ||
- name: Deploy to Cloud Server | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} # 云服务器 IP 或域名 | ||
username: ${{ secrets.SERVER_USER }} # SSH 用户名 | ||
key: ${{ secrets.SERVER_KEY }} # 私钥 | ||
port: ${{ secrets.SERVER_PORT }} # SSH 端口 | ||
source: dist/ # Astro 输出目录 | ||
target: /www/wwwroot/blog-astro-fuwari/ # 部署到服务器的路径 |