Skip to content

Commit

Permalink
ci: use latest tag's commit instead of tag ref
Browse files Browse the repository at this point in the history
  • Loading branch information
josedev-union committed Jan 20, 2024
1 parent 458d468 commit 7cee598
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ jobs:
echo "Fetching upstream"
git remote add tmp_upstream ${{ env.UPSTREAM_REPO }}
git fetch tmp_upstream --tags
latest_tag=$(git ls-remote --tags --sort=committerdate tmp_upstream|egrep -iv 'helm|rc'|tail -1|awk '{print $2}')
git remote --verbose
latest_tag_commit=$(git ls-remote --tags --sort=committerdate remote|egrep -iv 'helm|rc'|tail -1|awk '{print $1}')
echo "Pushing changings from tmp_upstream to origin"
git push origin "refs/remotes/tmp_upstream/$latest_tag:refs/heads/${{ env.SYNC_DEST_BRANCH }}" --force
echo "Pushing the latest tag commit as the origin SYNC_DEST_BRANCH"
git branch -D upstream
git checkout -b ${{ env.SYNC_DEST_BRANCH }} ${latest_tag_commit}
git push origin ${{ env.SYNC_DEST_BRANCH }} --force
echo "Removing tmp_upstream"
git remote rm tmp_upstream
Expand Down

0 comments on commit 7cee598

Please sign in to comment.