Hugo, Gitlab CI, Hosting the page by another hoster

To deploy to gitlab pages is relative simple. I plan to deploy the page by another hoster. I have to build a PRIVATE_KEY and a SSH_HOST_KEY.

Is it possible to leave the creation of the keys Gitlab? Where are the keys to deposit in Gitlab?

Here is my .gitlab-ci.yaml

image: monachus/hugo:latest

pages:
  script:
  - hugo
  - echo "${SSH_PRIVATE_KEY}" > id_rsa
  - chmod 700 id_rsa
  - mkdir "${HOME}/.ssh"
  - echo "${SSH_HOST_KEY}" > "${HOME}/.ssh/known_hosts"
  - rsync -hrvz --delete --exclude=_ -e 'ssh -i id_rsa' public/ user@example.com:/www/test/

  artifacts:
    paths:
    - public
  only:
  - master

test:
  script:
  - hugo
  except:
  - master

No idea. You should ask at the Gitlab forums.

1 Like