mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
[PM-14879] Release Branch creation workflow (#4294)
This commit is contained in:
parent
0967234ad8
commit
31bc171d6b
1 changed files with 56 additions and 0 deletions
56
.github/workflows/release-branch.yml
vendored
Normal file
56
.github/workflows/release-branch.yml
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
name: Cut Release Branch
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
release_type:
|
||||||
|
description: 'Release Type'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- RC
|
||||||
|
- Hotfix
|
||||||
|
rc_prefix_date:
|
||||||
|
description: 'RC - Prefix with date. E.g. 2024.11-rc1'
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-release-branch:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Create RC Branch
|
||||||
|
if: inputs.release_type == 'RC'
|
||||||
|
env:
|
||||||
|
RC_PREFIX_DATE: ${{ inputs.rc_prefix_date }}
|
||||||
|
run: |
|
||||||
|
if [ "$RC_PREFIX_DATE" = "true" ]; then
|
||||||
|
current_date=$(date +'%Y.%m')
|
||||||
|
branch_name="release/${current_date}-rc${{ github.run_number }}"
|
||||||
|
else
|
||||||
|
branch_name="release/rc${{ github.run_number }}"
|
||||||
|
fi
|
||||||
|
git switch main
|
||||||
|
git switch -c $branch_name
|
||||||
|
git push origin $branch_name
|
||||||
|
echo "# :cherry_blossom: RC branch: ${branch_name}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
|
- name: Create Hotfix Branch
|
||||||
|
if: inputs.release_type == 'Hotfix'
|
||||||
|
run: |
|
||||||
|
latest_tag=$(git describe --tags --abbrev=0)
|
||||||
|
if [ -z "$latest_tag" ]; then
|
||||||
|
echo "::error::No tags found in the repository"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
branch_name="release/hotfix-${latest_tag}"
|
||||||
|
git switch -c $branch_name $latest_tag
|
||||||
|
git push origin $branch_name
|
||||||
|
echo "# :fire: Hotfix branch: ${branch_name}" >> $GITHUB_STEP_SUMMARY
|
Loading…
Reference in a new issue