-
Notifications
You must be signed in to change notification settings - Fork 37
55 lines (50 loc) · 2.06 KB
/
create_branch_prefix.yml
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
name: Create Branch Prefix
on:
workflow_call:
inputs:
prefix:
required: true
type: string
description: 'Prefix to use for branch names (e.g. benchmark, release)'
version:
required: true
type: string
description: 'Version to use in branch names'
signing-key-id:
required: true
type: string
description: 'Signing key ID to use for signing commits'
outputs:
branch-prefix:
description: 'The generated branch prefix ({prefix}--{version}-)'
value: ${{ jobs.create-branch-prefix.outputs.branch-prefix }}
base-branch:
description: 'The generated base branch name ({prefix}--{version})'
value: ${{ jobs.create-branch-prefix.outputs.base-branch }}
secrets:
GPG_SIGNING_KEY:
required: true
jobs:
create-branch-prefix:
name: Create Branch and Branch Prefix
runs-on: ubuntu-latest
outputs:
branch-prefix: ${{ steps.create-prefix.outputs.branch-prefix }}
base-branch: ${{ steps.create-prefix.outputs.base-branch }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- id: create-prefix
shell: bash
run: |
VERSION="${{ inputs.version }}"
echo "branch-prefix=${{ inputs.prefix }}--$VERSION-" >> $GITHUB_OUTPUT
echo "base-branch=${{ inputs.prefix }}--$VERSION" >> $GITHUB_OUTPUT
- uses: ./.github/actions/configure_git
with:
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
signing-key-id: ${{ inputs.signing-key-id }}
- name: Create base branch
run: git checkout -b ${{ steps.create-prefix.outputs.base-branch }}
- run: git push origin ${{ steps.create-prefix.outputs.base-branch }}