-
Notifications
You must be signed in to change notification settings - Fork 1.4k
51 lines (48 loc) · 1.72 KB
/
Copy pathauto-dispatch.yaml
File metadata and controls
51 lines (48 loc) · 1.72 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
name: Build and Deploy (Dispatch)
on:
push:
branches:
- master
pull_request:
types: [closed]
jobs:
release-dispatch:
if: (github.event_name == 'push') || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.base_ref == 'master')
runs-on: ubuntu-latest
steps:
- name: Determine version level
id: level
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
# Extract labels from merged PR
LABELS="${{ join(github.event.pull_request.labels.*.name, ',') }}"
echo "PR Labels: $LABELS"
if [[ "$LABELS" == *"major"* ]]; then
echo "level=major" >> $GITHUB_OUTPUT
echo "Using PR label: major"
elif [[ "$LABELS" == *"minor"* ]]; then
echo "level=minor" >> $GITHUB_OUTPUT
echo "Using PR label: minor"
else
echo "level=patch" >> $GITHUB_OUTPUT
echo "Using PR label default: patch"
fi
else
# Push to master - default to patch
echo "level=patch" >> $GITHUB_OUTPUT
echo "Using push default: patch"
fi
- name: Send dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.CLOUD_DEVOPS_TOKEN }}
repository: ${{ secrets.dispatch_repo }}
event-type: release
client-payload: |
{
"level": "${{ steps.level.outputs.level }}",
"source": "${{ github.event_name }}",
"ref": "${{ github.ref }}",
"sha": "${{ github.sha }}",
"actor": "${{ github.actor }}"
}