~tcarrio/git-mirror

fd857f04248746002313d2b90f2722bbe924f93b — Tom Carrio 3 years ago 86f55b1
Simplying use cases to push all branches to remote
2 files changed, 2 insertions(+), 17 deletions(-)

M .build.yml
M git-mirror.sh
M .build.yml => .build.yml +1 -16
@@ 3,26 3,11 @@ packages:
  - git
sources:
  - https://git.sr.ht/~tcarrio/git-mirror
  - https://git.sr.ht/~tcarrio/build-helpers
environment:
  PROJECT_DIR: git-mirror
  HELPERS_DIR: build-helpers
  GIT_TARGET_REPO: git@github.com:tcarrio/github-mirror.git
secrets:
  - 4e983fc2-9d24-43eb-9986-1c18feb2e7b8
tasks:
  - mirror-any: |
      git-mirror/git-mirror.sh $PROJECT_DIR

  - mirror-master-only: |
      source $HELPERS_DIR/all.sh
      pushd $PROJECT_DIR

      if ! compare_branch master
      then
        echo "Skipping mirror task for non-master branch"
        exit 0
      fi
      popd

  - mirror-all: |
      git-mirror/git-mirror.sh $PROJECT_DIR
\ No newline at end of file

M git-mirror.sh => git-mirror.sh +1 -1
@@ 34,7 34,7 @@ pushd "${GIT_LOCAL_REPO}"

set -x
git remote add ${GIT_TARGET_REMOTE} ${GIT_TARGET_REPO}
git branch --show-current | xargs git push --force ${GIT_TARGET_REMOTE}
git push --all --force ${GIT_TARGET_REMOTE}

set +x
if [ $? -eq 0 ]