yams.media/.gitlab-ci.yml
Roger Gonzalez 72b750518d
Add test deploy stage to .gitlab-ci.yml
- Adds a test stage to build the site.
- Uses a specific Hugo image for testing.
- Only runs tests on merge requests and fr-translation.
2025-04-03 10:02:32 -03:00

31 lines
710 B
YAML

image: alpine:latest
stages:
- test
- deploy
test_build:
stage: test
image: klakegg/hugo:0.111.3-ext-alpine-ci
script:
- hugo version
- hugo --minify
only:
- merge_requests
- fr-translation
deploy:
stage: deploy
before_script:
- 'command -v ssh-agent >/dev/null || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- ssh -p $SSH_PORT $SSH_USER@$SSH_HOST "cd repo-fr && git stash && git pull --force origin fr-translation && ./build.sh"
only:
- fr-translation