Skip to content

Commit

Permalink
123aaa
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et committed Oct 21, 2024
1 parent ec273be commit 3237485
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/update-version-file-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
env:
TAG_VERSION: ${{ github.event.release.tag_name }}
steps:
# Step 1: Checkout the repository's code
# Step 1: Checkout the original repository's code
- name: Checkout code
uses: actions/checkout@v4
with:
Expand All @@ -22,43 +22,37 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Step 3: Switch to the main branch
- name: Switch to main branch
run: |
git checkout main
git pull origin main
# Step 4: Check and delete the existing tag (if present)
# Step 3: Check and delete existing tag
- name: Check and delete existing tag
run: |
if git rev-parse ${{ env.TAG_VERSION }} >/dev/null 2>&1; then
git tag -d ${{ env.TAG_VERSION }} # Delete local tag
git push --delete origin ${{ env.TAG_VERSION }} # Delete remote tag
fi
# Step 5: Update the version file
# Step 4: Update version file
- name: Update version file
run: |
echo "${{ env.TAG_VERSION }}" > version/version # Write the version to the file
# Step 6: Commit and push changes to the main branch
# Step 5: Commit and push changes to the correct branch
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add version/version
git commit -m "Update version to ${{ env.TAG_VERSION }}"
git push origin main # Push to the main branch
git push origin HEAD:${{ github.ref }} # Push to the current branch
# Step 7: Create and push the new tag
- name: Create and push new tag
# Step 6: Create and push new tag
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag ${{ env.TAG_VERSION }} # Create the new tag
git push origin ${{ env.TAG_VERSION }} # Push the tag to the remote repository
git tag ${{ env.TAG_VERSION }} # Create new tag
git push origin ${{ env.TAG_VERSION }} # Push the tag
# Step 8: Find and publish the draft release
# Step 7: Find and Publish Draft Release
- name: Find and Publish Draft Release
uses: actions/github-script@v6
with:
Expand Down Expand Up @@ -87,4 +81,4 @@ jobs:
core.info(`Draft Release ${draftRelease.tag_name} published successfully.`);
} else {
core.info("No matching draft release found.");
}
}

0 comments on commit 3237485

Please sign in to comment.