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 <haibin.wen3@gmail.com>
This commit is contained in:
DevTekVE 2024-08-04 03:29:00 +02:00 committed by GitHub
parent 03f76199f3
commit 963d356173
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 13 deletions

View File

@ -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
git push -u --force gitlab ${{ github.ref }}

2
release/ci/sync-lfs.sh Normal file → Executable file
View File

@ -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