mirror of https://gitlab.com/curben/blog
ci: utilize Gitlab's mirroring
- https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html - Commits to protected branches are push to mirror within a minute - Less one private key to manage
This commit is contained in:
parent
200c2fdcca
commit
19e17e1193
|
@ -9,7 +9,6 @@ variables:
|
|||
|
||||
test:
|
||||
before_script:
|
||||
- 'which ssh-agent || (apk update && apk add openssh-client git)'
|
||||
- npm install -g pnpm
|
||||
- pnpm install
|
||||
|
||||
|
@ -17,24 +16,6 @@ test:
|
|||
- pnpm install snyk && pnpm run snyk # Refer to "scripts" in package.json
|
||||
- pnpm 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
|
||||
# Discard changes before checking out branch
|
||||
- git reset HEAD --hard
|
||||
- git checkout master && git push mirror master
|
||||
- git checkout site && git push mirror site
|
||||
|
||||
rules:
|
||||
# Skip in renovate job
|
||||
- if: '$RENOVATE == "true"'
|
||||
|
@ -48,8 +29,7 @@ test:
|
|||
|
||||
renovate: # Check dependency update
|
||||
before_script:
|
||||
- apk update
|
||||
- apk add git
|
||||
- apk update && apk add git
|
||||
- npm install
|
||||
|
||||
script:
|
||||
|
|
Loading…
Reference in New Issue