ci: add Gitea workflow for docs deployment
Add workflow to automatically build and deploy documentation site on push to main branch
This commit is contained in:
59
.gitea/workflows/deploy.yaml
Normal file
59
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
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: [18.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: "/webroot/sites/zhaoguiyang"
|
||||||
|
EXCLUDE: "/node_modules/"
|
||||||
Reference in New Issue
Block a user