Skip to content

Release synchronization #1639

Release synchronization

Release synchronization #1639

name: Release synchronization
on:
schedule:
- cron: "0,15,30,51 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Cache Node.js modules
uses: actions/cache@v4
with:
path: |
node_modules
~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
${{ runner.os }}-
- name: Install dependencies
run: npm ci
- name: Run synchronization
run: mkdir -p cache && npm start
- name: Get all cache files with file hashes
id: track-files
run: node scripts/hash-tracker.js
- name: Commit changes to main branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Auto-sync: Synchronized files"
file_pattern: |
**/*
!sync_tracking.json
- name: Force push tracking to release branch
run: |
if [ -f sync_tracking.json ]; then
trackingContent=$(cat sync_tracking.json)
git checkout release 2>/dev/null || git checkout --orphan release
git rm -rf --quiet .
echo "$trackingContent" > modified_files_tracking.json
git add modified_files_tracking.json
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git commit -m "Sync tracking: $(date -u '+%Y-%m-%d %H:%M:%S UTC')"
git push origin release --force
echo "Force pushed tracking data to release branch"
git checkout main
else
echo "No tracking data generated"
fi