feat: creating deploy stage in .gitlab-ci.yml file
Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file Update .gitlab-ci.yml file
This commit is contained in:
parent
2bde51aad0
commit
d04ffe7b1c
|
@ -1,21 +1,36 @@
|
|||
image: node:alpine
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- node_modules/
|
||||
- .yarn
|
||||
|
||||
before_script:
|
||||
- apt-get update -qq && apt-get install
|
||||
|
||||
# stages order.
|
||||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
Build:
|
||||
image: node:alpine
|
||||
stage: build
|
||||
before_script:
|
||||
- yarn config set cache-folder .yarn
|
||||
- yarn install
|
||||
script:
|
||||
- yarn eleventy
|
||||
cache:
|
||||
paths:
|
||||
- node_modules/
|
||||
- .yarn
|
||||
artifacts:
|
||||
paths:
|
||||
- _site/
|
||||
|
||||
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
|
||||
|
|
Reference in a new issue