Skip to content

Commit

Permalink
ci: Improvements on the mirror and prebuilt flow (commaai#386)
Browse files Browse the repository at this point in the history
* 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 <haibin.wen3@gmail.com>
  • Loading branch information
devtekve and sunnyhaibin authored Aug 4, 2024
1 parent 03f7619 commit 963d356
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions .github/workflows/mirror_to_gitlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,18 @@ 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 }}

- name: Add GitLab public keys
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
git push -u --force gitlab ${{ github.ref }}
2 changes: 1 addition & 1 deletion release/ci/sync-lfs.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 963d356

Please sign in to comment.