Skip to content

ci: add upstream sync #1

ci: add upstream sync

ci: add upstream sync #1

Workflow file for this run

name: Sync with Latest Release
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
workflow_dispatch: # Allow manual triggering
pull_request:
branches:
- dev
jobs:
sync-with-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Get full history for commit count
token: ${{ secrets.PAT_SERVICE_ACCOUNT }}
- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Add upstream remote
run: |
git remote add upstream https://github.com/ggml-org/llama.cpp.git
git fetch upstream --tags # Fetch tags from upstream
- name: Sync master with latest release
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}
run: |
git checkout master
LATEST_RELEASE=$(git describe --tags --abbrev=0 upstream/master)
git reset --hard $LATEST_RELEASE
git push origin master --force
- name: Rebase dev onto master
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}
run: |
git checkout dev
echo "Attempting to rebase dev onto master..."
if ! git rebase master; then
echo "⚠️ Rebase conflict detected, aborting"
git rebase --abort
exit 1
fi
echo "Rebase successful, force pushing to dev..."
git push origin dev --force-with-lease
- name: Create version tag
env:
GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}
run: |
git checkout master
COMMIT_COUNT=$(git rev-list --count HEAD)
NEW_TAG="b${COMMIT_COUNT}"
echo "Creating new tag: $NEW_TAG"
# Check if tag already exists
if git rev-parse "$NEW_TAG" >/dev/null 2>&1; then
echo "Tag $NEW_TAG already exists, skipping tag creation"
else
git checkout dev
git tag "$NEW_TAG"
git push origin tag "$NEW_TAG"
fi