-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (63 loc) · 2.33 KB
/
create_release_branch.yaml
File metadata and controls
71 lines (63 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Create Release Branch
# on:
# release:
# types: [published]
# workflow_dispatch:
# inputs:
# tag:
# description: 'Tag name (e.g., v1.0.0)'
# required: true
# type: string
# jobs:
# create-branch:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# with:
# ref: develop
# fetch-depth: 0
# - name: Fetch all tags
# run: git fetch --all --tags
# - name: Extract tag name
# id: tag
# run: |
# if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
# TAG_NAME="${{ inputs.tag }}"
# else
# TAG_NAME=${GITHUB_REF#refs/tags/}
# fi
# echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
# echo "branch=release/${TAG_NAME}" >> $GITHUB_OUTPUT
# - name: Verify tag exists
# run: |
# if ! git rev-parse "${{ steps.tag.outputs.tag }}" >/dev/null 2>&1; then
# echo "Error: Tag ${{ steps.tag.outputs.tag }} does not exist"
# exit 1
# fi
# echo "Tag ${{ steps.tag.outputs.tag }} exists"
# - name: Check if branch already exists
# id: check
# run: |
# if git ls-remote --heads origin "${{ steps.tag.outputs.branch }}" | grep -q "${{ steps.tag.outputs.branch }}"; then
# echo "exists=true" >> $GITHUB_OUTPUT
# echo "Branch ${{ steps.tag.outputs.branch }} already exists - skipping"
# else
# echo "exists=false" >> $GITHUB_OUTPUT
# fi
# - name: Create release branch from develop
# if: steps.check.outputs.exists == 'false'
# run: |
# git config user.name "github-actions[bot]"
# git config user.email "github-actions[bot]@users.noreply.github.com"
# git checkout develop
# git pull origin develop
# git checkout -b ${{ steps.tag.outputs.branch }}
# git push origin ${{ steps.tag.outputs.branch }}
# - name: Summary
# run: |
# if [ "${{ steps.check.outputs.exists }}" = "true" ]; then
# echo "Branch ${{ steps.tag.outputs.branch }} already exists - skipped"
# else
# echo "Created branch: ${{ steps.tag.outputs.branch }} from develop"
# fi