Files
demo-deploy/.gitea/workflows/deploy.yml
T
admin 66e4bf6e89
自动部署示例 / deploy (push) Successful in 1m15s
init: 自动部署示例
2026-10-10 16:02:39 +08:00

26 lines
702 B
YAML

name: 自动部署示例
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 拉取代码
uses: actions/checkout@v4
- name: 发布到 nginx 网页目录
run: |
set -e
DEST=/sites/demo-deploy
mkdir -p "$DEST"
# 纯静态:直接同步。如果是需要构建的前端,改成:
# npm ci && npm run build && cp -r dist/* "$DEST"/
cp -r ./* "$DEST"/
# 注入本次构建时间,方便肉眼确认每次 push 都更新了
sed -i "s/__DEPLOY_TIME__/$(date '+%F %T')/" "$DEST/index.html"
echo "已发布到 $DEST"
ls -l "$DEST"