Files
fly-personal-site/.gitea/workflows/deploy.yml
T
wxf f0fd4dd48c
Deploy personal site / deploy (push) Successful in 45s
Install build dependencies in deploy workflow
2026-06-29 11:19:54 +08:00

47 lines
1.1 KiB
YAML

name: Deploy personal site
on:
workflow_dispatch:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
env:
NODE_HOME: /www/server/nodejs/node-v20.20.2-linux-x64-glibc-217
DEPLOY_DIR: /www/wwwroot/flys_blog
REPO_URL: http://124.221.147.173:3000/fly/fly-personal-site.git
steps:
- name: Checkout
run: |
rm -rf repo
git clone --branch master --depth 1 "$REPO_URL" repo
cd repo
git rev-parse --short HEAD
- name: Build
run: |
cd repo
export PATH="$NODE_HOME/bin:$PATH"
node -v
npm -v
npm ci --include=dev
npm run build
test -f out/index.html
- name: Deploy
run: |
cd repo
rm -rf "$DEPLOY_DIR.tmp"
mkdir -p "$DEPLOY_DIR.tmp"
cp -a out/. "$DEPLOY_DIR.tmp"/
chown -R www:www "$DEPLOY_DIR.tmp"
find "$DEPLOY_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
cp -a "$DEPLOY_DIR.tmp"/. "$DEPLOY_DIR"/
chown -R www:www "$DEPLOY_DIR"
rm -rf "$DEPLOY_DIR.tmp"