From e67014b8133402050bc948e563dcb9793fd75662 Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Wed, 15 Apr 2020 03:38:39 +0100 Subject: [PATCH] ci: update github mirror --- .gitlab-ci.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f28072..4f22c0a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,15 +5,33 @@ cache: # add cache to 'node_modules' for speeding up builds - node_modules/ # Node modules and dependencies before_script: - - apk update && apk add git - npm install --only=prod -g npm - npm install --only=prod test: + before_script: + - 'which ssh-agent || (apk update && apk add openssh-client git)' + script: - npm install --only=prod snyk && npm run snyk # Refer to "scripts" in package.json - npm run hexo + # Update github mirror + after_script: + # Import SSH key + - eval $(ssh-agent -s) + - echo "$GH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + + # (workaround) force exit code 0 + - ssh -T git@github.com || ":" + - git remote add mirror git@github.com:curbengh/blog.git + - git push mirror master + - git push mirror site + rules: # Skip in renovate job - if: '$RENOVATE == "true"'