stages:
  - sync

variables:
  GOPATH: "/home/gopath"
  SrcPath: "mongo.games.com/goserver" # 项目相对于GOPATH/src的路径

default:
  tags:
    - gitlab

sync_job:
  stage: sync
  only:
    - main
  script:
    - git checkout $CI_COMMIT_REF_NAME
    - git pull origin $CI_COMMIT_REF_NAME
    - echo $GOPATH/src/$SrcPath
    - rsync -rvc --no-perms --delete ./* $GOPATH/src/$SrcPath