-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (46 loc) · 1.63 KB
/
feature-branch.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
name: Build on feature/fix branch
on:
# Called by other workflows only.
workflow_call:
inputs:
do_pack:
description: 'If this build should be packed as NuGet package.'
required: true
type: boolean
jobs:
# Determines the feature branch name.
get-feature-branch:
runs-on: ubuntu-latest
# Set the output for this job to make it accessible in the whole workflow.
outputs:
# Use the step with ID "normalize" and from the ouput with name "branch_name".
branch_name: ${{ steps.normalize.outputs.branch_name }}
steps:
- uses: actions/checkout@v3
- name: Normalize branch name
run: |
# Take the branch name by GitHub variable "ref_name".
branch="${{ github.ref_name }}"
# Remove special characters.
noSlashes=`echo $branch | sed "s/[^[:alnum:]]//g"`
# Remove "/feature".
noFeature="${noSlashes/feature/}"
# Remove "/fix".
noFix="${noFeature/fix/}"
# Shorten name to 20 characters. Set it as output of the name "branch_name".
echo "branch_name=$( echo $noFix | cut -c 1-20 )" >> $GITHUB_OUTPUT
id: normalize
feature-branch:
# Requires the step above.
needs: get-feature-branch
# Run build-and-pack.yml.
uses: ./.github/workflows/build-and-pack.yml
with:
configuration: "Debug"
is_prerelease: true
do_pack: ${{ inputs.do_pack }}
# Needs.<job-name> gives access to the prior job's output.
suffix: "alpha-${{ needs.get-feature-branch.outputs.branch_name }}"
publish_target: "None"
# Pass on secrets to the next workflow.
secrets: inherit