mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2026-03-07 06:10:16 +01:00
refactor(ci): use temporary branch for cache builds
Some checks failed
CI / build (push) Has been cancelled
Some checks failed
CI / build (push) Has been cancelled
- Create unique temp branch (temp-cache-build-<run-id>) for each build - Prevents any artifacts on main branch - Auto-cleanup after successful push to similarity-cache-data - Maintains clean git history
This commit is contained in:
parent
048102c171
commit
97da117ccb
1 changed files with 17 additions and 0 deletions
17
.github/workflows/build-similarity-cache.yml
vendored
17
.github/workflows/build-similarity-cache.yml
vendored
|
|
@ -73,6 +73,15 @@ jobs:
|
|||
fi
|
||||
fi
|
||||
|
||||
- name: Create temporary build branch
|
||||
if: steps.check_cache.outputs.needs_build == 'true'
|
||||
run: |
|
||||
# Create a unique temporary branch for this build
|
||||
TEMP_BRANCH="temp-cache-build-${{ github.run_id }}"
|
||||
echo "TEMP_BRANCH=$TEMP_BRANCH" >> $GITHUB_ENV
|
||||
git checkout -b $TEMP_BRANCH
|
||||
echo "Created temporary branch: $TEMP_BRANCH"
|
||||
|
||||
- name: Run initial setup
|
||||
if: steps.check_cache.outputs.needs_build == 'true'
|
||||
run: |
|
||||
|
|
@ -276,6 +285,14 @@ jobs:
|
|||
|
||||
echo "Successfully pushed cache to similarity-cache-data branch"
|
||||
|
||||
- name: Cleanup temporary branch
|
||||
if: always() && steps.check_cache.outputs.needs_build == 'true'
|
||||
run: |
|
||||
# Return to original branch and delete temporary branch
|
||||
git checkout ${{ github.ref_name }} 2>/dev/null || git checkout main
|
||||
git branch -D $TEMP_BRANCH 2>/dev/null || true
|
||||
echo "Cleaned up temporary branch: $TEMP_BRANCH"
|
||||
|
||||
- name: Summary
|
||||
if: always()
|
||||
run: |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue