.gitlab-ci.yml 1.33 KB
Newer Older
mh's avatar
mh committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
---
image: $CI_REGISTRY/immerda/container-images/yarn-gen:latest

stages:
  - build
  - deploy

build:
  tags:
    - container
  script:
    - git clone https://code.immerda.ch/immerda/apps/wkd-frontend.git
    - cd wkd-frontend
    - cp -a ../{static,index.html,icon.png} public/
    - rm -f public/favicon.ico
    - yarn -v
    - yarn install
    - yarn run build
    - curl -o dist/ipick.js https://code.immerda.ch/immerda/content/ipick/-/raw/master/ipick.js
    - tar cfz site.tar.gz dist
mh's avatar
mh committed
21
    - mv site.tar.gz ../
mh's avatar
mh committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
  artifacts:
    paths:
      - site.tar.gz
    expire_in: 1 day
  stage: build

deploy:
  tags:
    - container
  script:
    # Start SSH agent
    - eval $(ssh-agent -s)
    # Add the SSH key stored in the $DEPLOY_KEY variable to the agent store
    # It is the base64 encoded private key
    - echo "${DEPLOY_KEY}" | base64 -d | ssh-add - > /dev/null
    - mkdir -p --mode=0700 ~/.ssh
    - printf "${DEPLOY_HOST} ssh-ed25519 ${DEPLOY_HOST_ED_KEY}
      " > ~/.ssh/known_hosts
    - tar fxv site.tar.gz
    # lftp needs a "dummy" password, even if key-based authentication is used.
    - lftp -e "mirror -eRv -x ^.well-known/ dist www; quit;" -u $DEPLOY_USER,dummy sftp://$DEPLOY_HOST
  stage: deploy
  only:
    # This job relies on secret env vars, which are only available in our repo.
    - master
  variables:
    GIT_STRATEGY: none