update
All checks were successful
Astro 自动部署 / deploy (push) Successful in 31s

This commit is contained in:
2026-02-18 20:32:02 +08:00
parent 836267b19d
commit b5ead6c093

53
.gitea/workflows/main.yml Normal file
View File

@@ -0,0 +1,53 @@
name: Astro 自动部署
on:
push:
branches:
- master
release:
types:
- published
workflow_dispatch:
env:
TZ: Asia/Shanghai
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 检查分支
uses: actions/checkout@v4
with:
ref: master
- name: 安装 Node
uses: actions/setup-node@v4
with:
node-version: "22.x"
# 如果你使用 npm开启缓存可以省去手动配置 actions/cache
cache: 'npm'
- name: 安装依赖
run: |
npm install
- name: 生成静态文件
run: |
# Astro 默认的构建命令
npm run build
- name: 部署
run: |
# 注意Astro 默认输出目录是 distHexo 是 public
cd ./dist
git init
git config user.name "${{ gitea.actor }}"
git config user.email "${{ gitea.actor }}@noreply.gitea.io"
git add .
git commit -m "${{ gitea.event.head_commit.message }} ·· [$(date +"%Z %Y-%m-%d %A %H:%M:%S")]"
# 强制推送到远程仓库的 page 分支
git push --force --quiet "https://${{ gitea.actor }}:${{ secrets.DEPLOY_TOKEN }}@git.biss.click/biss/blog.git" master:page
- name: Webhook 通知服务器
run: |
# curl -k -X POST "https://panel.biss.click/hook?access_key=1XJG8IvYTSZVvD5dpm86GYIpQxgxBcucULnX1MFskZSKayXU"