-
-
Notifications
You must be signed in to change notification settings - Fork 111
79 lines (68 loc) · 2.43 KB
/
release-drafter.yml
File metadata and controls
79 lines (68 loc) · 2.43 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
72
73
74
75
76
77
78
79
# SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Release Drafter
permissions:
contents: write
pull-requests: write
on:
push:
branches:
- stable*
pull_request_target:
branches:
- stable*
types: [closed]
jobs:
update_release_draft:
if: >
(github.event_name == 'push' && startsWith(github.ref, 'refs/heads/stable')) ||
(
github.event_name == 'pull_request_target' &&
github.event.pull_request.merged == true &&
startsWith(github.event.pull_request.base.ref, 'stable')
)
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
fetch-tags: true
- name: Resolve release draft version
id: resolve-version
env:
EVENT_NAME: ${{ github.event_name }}
PUSH_REF_NAME: ${{ github.ref_name }}
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -eu
branch="$PUSH_REF_NAME"
if [ "$EVENT_NAME" = "pull_request_target" ]; then
branch="$PR_BASE_REF"
fi
previous_tag=$(git describe --tags --abbrev=0 "origin/$branch")
current_version=${previous_tag#v}
major=${current_version%%.*}
version_tail=${current_version#*.}
minor=${version_tail%%.*}
patch=${version_tail##*.}
release_messages=$(git log --format='%s%n%b' "${previous_tag}..origin/${branch}")
if printf '%s\n' "$release_messages" | grep -Eiq '(^|\])\s*feat:|vue3 phase|migration to vue3|script setup ts|typescript'; then
minor=$((minor + 1))
patch=0
else
patch=$((patch + 1))
fi
version="${major}.${minor}.${patch}"
echo "branch=${branch}" >> "$GITHUB_OUTPUT"
echo "previous_tag=${previous_tag}" >> "$GITHUB_OUTPUT"
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Draft release for this branch
uses: release-drafter/release-drafter@v7
with:
config-name: release-drafter.yml
commitish: ${{ steps.resolve-version.outputs.branch }}
version: ${{ steps.resolve-version.outputs.version }}
name: v${{ steps.resolve-version.outputs.version }}
tag: v${{ steps.resolve-version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}