From 5b0f0375673f31f8e568c7dda64db3f84286aebc Mon Sep 17 00:00:00 2001 From: zihluwang Date: Mon, 25 May 2026 08:25:19 +0800 Subject: [PATCH] ci: add CI files for build and deploy --- .gitlab-ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..63ade69 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,33 @@ +image: node:24.15-trixie-slim + +stages: + - build + - deploy + +build: + stage: build + rules: + - if: $CI_RELEASE_DESCRIPTION + script: + - corepack enable + - corepack prepare pnpm --activate + - pnpm install --frozen-lockfile + - pnpm build + artifacts: + paths: + - dist/ + expire_in: 7 days + +deploy: + stage: deploy + rules: + - if: $CI_RELEASE_DESCRIPTION + needs: + - build + script: + - apt-get update -qq && apt-get install -y -qq openssh-client rsync + - mkdir -p ~/.ssh + - echo "$SSH_PRIVATE_KEY_BASE64" | base64 -d > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - ssh-keyscan -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts + - rsync -avz --delete dist/ "${SSH_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"