-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathrelease-drafter.yml
More file actions
64 lines (55 loc) · 1.75 KB
/
release-drafter.yml
File metadata and controls
64 lines (55 loc) · 1.75 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
# 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
- name: Fetch tags for this branch
run: git fetch --tags origin ${{ github.ref_name }}
- name: Get last tag from this branch
id: lasttag
run: |
last_tag=$(git describe --tags --abbrev=0 || echo "v0.0.0")
echo "LAST_TAG=$last_tag" >> $GITHUB_ENV
- name: Compute next version (robust)
id: nexttag
run: |
last="${LAST_TAG#v}"
# Remove qualquer sufixo como -rc1, -beta, etc.
clean=$(echo "$last" | sed 's/[^0-9.].*$//')
IFS='.' read -r major minor patch <<< "$clean"
major=${major:-0}
minor=${minor:-0}
patch=${patch:-0}
patch=$((patch + 1))
next="v${major}.${minor}.${patch}"
echo "NEXT_TAG=$next" >> $GITHUB_ENV
- name: Draft release for this branch
uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RESOLVED_VERSION: ${{ env.NEXT_TAG }}