mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
CI: add workflow to create hotfix branch (#2521)
This commit is contained in:
38
.github/workflows/hotfix-branch-creation.yml
vendored
Normal file
38
.github/workflows/hotfix-branch-creation.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: Create a new hotfix branch
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
create_branch:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.AUTO_RELEASE_PAT }}
|
||||
|
||||
- name: Check if the input is valid tag
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ ${{github.ref}} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "::notice::${{github.ref}} is a valid tag."
|
||||
else
|
||||
echo "::error::${{github.ref}} is not a valid tag."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Create hotfix branch
|
||||
shell: bash
|
||||
run: |
|
||||
HOTFIX_BRANCH="hotfix-${GITHUB_REF#refs/tags/v}"
|
||||
|
||||
if git switch --create "$HOTFIX_BRANCH"; then
|
||||
git push origin "$HOTFIX_BRANCH"
|
||||
echo "::notice::Created hotfix branch: $HOTFIX_BRANCH"
|
||||
else
|
||||
echo "::error::Failed to create hotfix branch"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user