chore: add 1.21.11 branch for sync workflow #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Shared JSON Files to Other Branches | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/sync-shared-json.yml | |
| - skyblock/containers.json | |
| - skyblock/cooldowns.json | |
| - skyblock/enchants.json | |
| - skyblock/locations.json | |
| - skyblock/seaCreatures.json | |
| - skyblock/skillXp.json | |
| - skyblock/slayerLocations.json | |
| env: | |
| TARGET_BRANCHES: > | |
| 1.8.9 | |
| 1.21.5 | |
| 1.21.10 | |
| 1.21.11 | |
| SHARED_FILES: > | |
| skyblock/cooldowns.json | |
| skyblock/enchants.json | |
| skyblock/locations.json | |
| skyblock/seaCreatures.json | |
| skyblock/skillXp.json | |
| skyblock/slayerLocations.json | |
| # skyblock/containers.json | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync-shared-json: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Sync shared JSON files to target branches | |
| run: | | |
| BRANCHES=($TARGET_BRANCHES) | |
| for BRANCH in "${BRANCHES[@]}"; do | |
| echo "Switching to branch: $BRANCH" | |
| git checkout $BRANCH | |
| echo "Copying shared files from main to $BRANCH" | |
| git checkout main -- $SHARED_FILES | |
| git add $SHARED_FILES | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit for $BRANCH. Skipping." | |
| else | |
| git commit -m "Sync shared JSON files from main to $BRANCH" | |
| git push origin $BRANCH | |
| fi | |
| done | |
| - name: Checkout back to main | |
| run: git checkout main |