Added .gitlab-ci.yml for github mirror.

This commit is contained in:
2021-06-26 15:23:15 +12:00
parent ad465ed333
commit b6052aa070

31
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,31 @@
before_script:
# Ensure prerequisites are installed
- 'which ssh-agent || (apk update && apk add openssh-client git)'
# Launch ssh agent and add our key
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null
# Ensure known hosts exists and is populated
- mkdir ~/.ssh && chmod 700 ~/.ssh
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts
push_github:
type: deploy
environment:
name: github
url: github.com/jmhbnz/raspi-k3s
script:
# Output git status
- git checkout master && git pull && git status
# Add a new remote for github
- git remote add github git@github.com:jmhbnz/raspi-k3s.git || true
# Push to the new remote
- git push github master
only:
refs:
- master