Update the TARGET path in deploy workflow to point to the correct directory without the 'dist' subfolder
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
name: Deploy docs for Site
|
|
run-name: ${{ gitea.actor }} is building out Gitea Actions 🚀
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [20.x]
|
|
steps:
|
|
- name: Checkout repository code
|
|
uses: https://gitea.com/actions/checkout@v4
|
|
with:
|
|
ref: 'main'
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
# Skip pnpm cache to reduce overhead
|
|
- name: Install pnpm
|
|
run: |
|
|
if ! command -v pnpm &> /dev/null; then
|
|
npm install -g pnpm@9
|
|
else
|
|
echo "pnpm is already installed"
|
|
fi
|
|
|
|
- name: Check Node.js and pnpm versions
|
|
run: |
|
|
echo "pnpm version ===>" && pnpm -v
|
|
echo "node version ===>" && node -v
|
|
|
|
# Simplify node_modules handling without caching
|
|
- name: Install dependencies
|
|
run: |
|
|
if [ ! -d "node_modules" ] || [ "$(find package.json -newer node_modules)" ]; then
|
|
echo "Dependencies are outdated or missing, installing..."
|
|
pnpm install
|
|
else
|
|
echo "Dependencies are up-to-date, skipping installation."
|
|
fi
|
|
|
|
- name: Build site
|
|
run: pnpm build
|
|
|
|
- name: ssh deploy
|
|
uses: easingthemes/ssh-deploy@v5.1.0
|
|
with:
|
|
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }}
|
|
REMOTE_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
REMOTE_USER: ${{ secrets.DEPLOY_USER }}
|
|
SOURCE: "/dist/"
|
|
TARGET: "/opt/1panel/apps/openresty/openresty/www/sites/zhaoguiyang.com/index"
|
|
EXCLUDE: "/node_modules/"
|