-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.45 KB
/
cd.yml
File metadata and controls
50 lines (42 loc) · 1.45 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
name: Continuous Delivery
on:
pull_request:
types:
- closed
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
permissions:
contents: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Process Pull Request
id: process-pr
run: |
LABELS=$(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH")
echo "::debug::Labels: $LABELS"
if echo "$LABELS" | grep -q 'major'; then
RELEASE_TYPE_TAG="major"
elif echo "$LABELS" | grep -q 'minor'; then
RELEASE_TYPE_TAG="minor"
elif echo "$LABELS" | grep -q 'patch'; then
RELEASE_TYPE_TAG="patch"
else
echo "::error::No tag found matching a release type."
exit 1
fi
echo "Release tag: $RELEASE_TYPE_TAG"
echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Create or Update release type tag
run: |
git tag -fa ${{ steps.process-pr.outputs.release_type }} -m "${{ steps.process-pr.outputs.release_type }}"
git push origin -f ${{ steps.process-pr.outputs.release_type }}