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 默认输出目录是 dist,Hexo 是 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/profile.git" master:page - name: Webhook 通知服务器 run: | # curl -k -X POST "https://panel.biss.click/hook?access_key=1XJG8IvYTSZVvD5dpm86GYIpQxgxBcucULnX1MFskZSKayXU"