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"