mirror of
https://gitlab.wasp.best/sel/web.git
synced 2026-04-28 21:44:08 +02:00
37 lines
856 B
YAML
37 lines
856 B
YAML
stages:
|
|
- build
|
|
- deploy
|
|
|
|
build-job:
|
|
stage: build
|
|
image: debian:unstable
|
|
before_script:
|
|
- apt-get update && apt-get install -y hugo
|
|
script:
|
|
- hugo --minify
|
|
artifacts:
|
|
paths:
|
|
- public/
|
|
only:
|
|
- main
|
|
|
|
deploy-job:
|
|
stage: deploy
|
|
before_script:
|
|
# stolen from https://help.ovhcloud.com/csm/asia-vps-deploy-website-gitlab-ci-cd?id=kb_article_view&sysparm_article=KB0066282
|
|
# and from https://docs.gitlab.com/ci/jobs/ssh_keys/
|
|
- apt-get update && apt-get install -y rsync openssh-client
|
|
|
|
- eval $(ssh-agent -s)
|
|
- chmod 400 "$SSH_PRIVATE_KEY"
|
|
- ssh-add "$SSH_PRIVATE_KEY"
|
|
|
|
- mkdir -p ~/.ssh
|
|
- chmod 700 ~/.ssh
|
|
|
|
- cp "$SSH_KNOWN_HOSTS" ~/.ssh/known_hosts
|
|
- chmod 644 ~/.ssh/known_hosts
|
|
script:
|
|
- rsync -avz --delete public/ debian@wasp.best:/var/www/html/
|
|
only:
|
|
- main
|