ci: add gitlab ci pipeline for build and deploy
This commit is contained in:
@@ -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"
|
||||||
Reference in New Issue
Block a user