This repository has been archived on 2023-03-14. You can view files and clone it, but cannot push or open issues or pull requests.
personal-website-old/.gitlab-ci.yml

38 lines
1 KiB
YAML
Raw Normal View History

2021-05-21 14:17:05 +00:00
stages:
- build
- deploy
2021-05-21 14:17:05 +00:00
Build:
image: node:alpine
2021-05-21 14:17:05 +00:00
stage: build
before_script:
2021-05-21 14:17:05 +00:00
- yarn config set cache-folder .yarn
- yarn install
script:
- yarn run build
cache:
paths:
- node_modules/
- .yarn
artifacts:
paths:
- _site/
expire_in: 1 week
Deploy:
image: alpine
stage: deploy
before_script:
- apk add openssh-client findutils
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- cd _site
- find . -depth -type "f" -printf "%P\n" | grep -v -e content -e .sftp | awk '{print "rm "$1}' > .sftp_rm
- find . -depth -type "d" -printf "%P\n" | grep -v -e content -e .sftp | awk '{print "rmdir "$1}' > .sftp_rmdir
- ls | grep -v -e content -e .sftp | awk '{print "put -R "$1}' > .sftp_put
- cat .sftp_rm .sftp_rmdir .sftp_put | sftp -v fainsil@ftp.perso.bde.inp-toulouse.fr:www_public