Create temp branch to handle release changes
Introduced a temporary branch for release preparation steps before merging into the release branch. This isolates changes such as file removals and modifications until all updates are ready, improving workflow clarity and reducing risk of conflicts. After merging, the temp branch is deleted to keep the repository clean.
This commit is contained in:
15
.github/workflows/CreateRelease.yml
vendored
15
.github/workflows/CreateRelease.yml
vendored
@@ -94,20 +94,29 @@ jobs:
|
|||||||
id: create_temp_branch
|
id: create_temp_branch
|
||||||
if: steps.check_version.outputs.skip_release == 'false'
|
if: steps.check_version.outputs.skip_release == 'false'
|
||||||
run: |
|
run: |
|
||||||
|
# Create a temporary branch to commit the changes
|
||||||
|
git checkout -b temp-release-branch
|
||||||
|
|
||||||
# Remove unwanted files
|
# Remove unwanted files
|
||||||
rm -rf .gitignore package-lock.json
|
rm -rf .gitignore package-lock.json
|
||||||
|
|
||||||
# Checkout the release branch
|
|
||||||
git checkout release
|
|
||||||
|
|
||||||
# Add new/modified files
|
# Add new/modified files
|
||||||
git add README.md package.json LICENSE dist/ src/ tsconfig.json
|
git add README.md package.json LICENSE dist/ src/ tsconfig.json
|
||||||
|
|
||||||
# Commit the changes
|
# Commit the changes
|
||||||
git commit -m "Prepare files for release ${{ env.VERSION }}"
|
git commit -m "Prepare files for release ${{ env.VERSION }}"
|
||||||
|
|
||||||
|
# Checkout the release branch
|
||||||
|
git checkout release
|
||||||
|
|
||||||
|
# Merge the changes from the temporary branch into the release branch
|
||||||
|
git merge --no-ff temp-release-branch
|
||||||
|
|
||||||
# Push the changes to the release branch
|
# Push the changes to the release branch
|
||||||
git push origin release
|
git push origin release
|
||||||
|
|
||||||
|
# Delete the temporary branch
|
||||||
|
git branch -d temp-release-branch
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
Reference in New Issue
Block a user