From 963d356173f5a53651df957217201e53c4e9bc7a Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Sun, 4 Aug 2024 03:29:00 +0200 Subject: [PATCH] ci: Improvements on the mirror and prebuilt flow (#386) * Remove redundant git lfs pull command The `git lfs pull` command in the GitHub workflow is redundant and has been removed. Additionally, the `sync-lfs.sh` script has been updated to push all LFS objects to the origin repository. * using force push instead of trying to merge * Bumping ssh agent to 0.9.0 * Syntax --------- Co-authored-by: Jason Wen --- .github/workflows/mirror_to_gitlab.yaml | 15 +++------------ release/ci/sync-lfs.sh | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) mode change 100644 => 100755 release/ci/sync-lfs.sh diff --git a/.github/workflows/mirror_to_gitlab.yaml b/.github/workflows/mirror_to_gitlab.yaml index e605458ad..38c95bac2 100644 --- a/.github/workflows/mirror_to_gitlab.yaml +++ b/.github/workflows/mirror_to_gitlab.yaml @@ -29,7 +29,7 @@ jobs: git config --global user.email 'action@github.com' - name: Set up SSH - uses: webfactory/ssh-agent@v0.5.3 + uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} @@ -37,19 +37,10 @@ jobs: run: | ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts + # Note: If you have issues with "push rejected missing LFS" or something make sure you disabled LFS on the GITLAB repo if you intend to use a different LFS repo other than the target repo. - name: Sync and commit changes id: sync-and-commit run: | - git lfs pull - # Add GitLab remote git remote add gitlab git@gitlab.com:sunnypilot/sunnyhaibin/sunnypilot-github-mirror.git - - # Fetch from GitLab and check if the branch exists - if git fetch gitlab ${{ github.ref }}; then - # Merge changes from GitLab if the branch exists - git merge gitlab/${{ github.ref_name }} --allow-unrelated-histories --strategy-option=theirs - else - echo "Branch does not exist on GitLab, skipping merge." - fi - git push -u gitlab ${{ github.ref }} # If you have issues with "push rejected missing LFS" or something. Make sure you disabled LFS on the GITLAB repo if you intend to use a different LFS repo other than the target repo \ No newline at end of file + git push -u --force gitlab ${{ github.ref }} diff --git a/release/ci/sync-lfs.sh b/release/ci/sync-lfs.sh old mode 100644 new mode 100755 index a32872435..778d31005 --- a/release/ci/sync-lfs.sh +++ b/release/ci/sync-lfs.sh @@ -4,4 +4,4 @@ mv .lfsconfig-comma .lfsconfig git lfs fetch --all; git lfs pull mv .lfsconfig .lfsconfig-comma mv .lfsconfig.bak .lfsconfig -git lfs fetch --all; git lfs push origin main +git lfs fetch --all; git lfs push --all origin