mirror of
https://github.com/bitwarden/android.git
synced 2026-04-28 03:48:14 -05:00
[PM-16211] chore(ci): Fix hotfix branch creation workflow by retrieving the last tag across all branches (#4491)
This commit is contained in:
13
.github/workflows/release-branch.yml
vendored
13
.github/workflows/release-branch.yml
vendored
@@ -10,10 +10,6 @@ on:
|
||||
options:
|
||||
- RC
|
||||
- Hotfix
|
||||
rc_prefix_date:
|
||||
description: 'RC - Prefix with date. E.g. 2024.11-rc1'
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
jobs:
|
||||
create-release-branch:
|
||||
@@ -30,7 +26,7 @@ jobs:
|
||||
- name: Create RC Branch
|
||||
if: inputs.release_type == 'RC'
|
||||
env:
|
||||
RC_PREFIX_DATE: ${{ inputs.rc_prefix_date }}
|
||||
RC_PREFIX_DATE: "true" # replace with input if needed
|
||||
run: |
|
||||
if [ "$RC_PREFIX_DATE" = "true" ]; then
|
||||
current_date=$(date +'%Y.%m')
|
||||
@@ -46,12 +42,17 @@ jobs:
|
||||
- name: Create Hotfix Branch
|
||||
if: inputs.release_type == 'Hotfix'
|
||||
run: |
|
||||
latest_tag=$(git describe --tags --abbrev=0)
|
||||
latest_tag=$(git tag -l --sort=-creatordate | head -n 1)
|
||||
if [ -z "$latest_tag" ]; then
|
||||
echo "::error::No tags found in the repository"
|
||||
exit 1
|
||||
fi
|
||||
branch_name="release/hotfix-${latest_tag}"
|
||||
echo "🌿 branch name: $branch_name"
|
||||
if git show-ref --verify --quiet "refs/remotes/origin/$branch_name"; then
|
||||
echo "# :fire: :warning: Hotfix branch already exists: ${branch_name}" >> $GITHUB_STEP_SUMMARY
|
||||
exit 0
|
||||
fi
|
||||
git switch -c $branch_name $latest_tag
|
||||
git push origin $branch_name
|
||||
echo "# :fire: Hotfix branch: ${branch_name}" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
Reference in New Issue
Block a user