Deploy via rsync to venus.vps instead of GitLab Pages

Uses a per-site SSH key jailed on the server via rrsync. Requires CI
variables DEPLOY_SSH_KEY and DEPLOY_TARGET (user@host).
This commit is contained in:
Alex Gleason committed 2026-04-29 15:09:27 -05:00
1 parent 4ca7e20011
commit b9b297d832
1 file changed
+11 -8
+11 -8
View File
@@ -2,7 +2,7 @@ image: node:25
default:
interruptible: true
timeout: 1 minute
timeout: 20 minutes
cache:
key:
files:
@@ -28,19 +28,22 @@ test:
- npm run build
- npm run test
pages:
deploy:
stage: deploy
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $DEPLOY_SSH_KEY && $DEPLOY_TARGET
script:
- npm ci
- npm run build
- rm -rf public
- mv dist public
artifacts:
paths:
- public
- cp dist/index.html dist/404.html
- apt-get update -qq && apt-get install -y --no-install-recommends rsync openssh-client >/dev/null
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$DEPLOY_SSH_KEY" | tr -d '\r' > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
- ssh-keyscan -H "${DEPLOY_TARGET##*@}" >> ~/.ssh/known_hosts 2>/dev/null
- rsync -av --exclude=sw.js --exclude=index.html -e "ssh -i ~/.ssh/id_ed25519" dist/ "${DEPLOY_TARGET}:/"
- rsync -av -e "ssh -i ~/.ssh/id_ed25519" dist/index.html "${DEPLOY_TARGET}:/"
deploy-nsite:
stage: deploy