ci: add gitlab ci pipeline for build and deploy

This commit is contained in:
siujamo
2026-05-19 22:23:43 -05:00
parent 3e5ca77133
commit 60093fa3bb
+37
View File
@@ -0,0 +1,37 @@
workflow:
rules:
- if: $CI_COMMIT_BRANCH == "main"
stages:
- build
- deploy
build:
stage: build
image: node:24.15-trixie-slim
before_script:
- corepack enable
- corepack prepare pnpm@latest --activate
- pnpm config set store-dir .pnpm-store
script:
- pnpm install --frozen-lockfile
- pnpm build
artifacts:
paths:
- doc_build/
deploy:
stage: deploy
image: alpine:latest
needs:
- build
before_script:
- apk add --no-cache openssh-client rsync
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan -H onixbyte.cn >> ~/.ssh/known_hosts
script:
- rsync -avz --delete doc_build/ ${SSH_USER}@onixbyte.cn:${DEPLOY_PATH}
rules:
- if: $CI_COMMIT_BRANCH == "main"