Skip to content

Commit 65590e6

Browse files
committed
Set up release-drafter
1 parent 2254d10 commit 65590e6

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed

.github/release-drafter.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# https://github.com/release-drafter/release-drafter?tab=readme-ov-file#configuration-options
2+
template: |
3+
$CHANGES
4+
5+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
6+
name-template: 'docs-builder v$RESOLVED_VERSION'
7+
tag-template: 'v$RESOLVED_VERSION'
8+
change-template: '- $TITLE by @$AUTHOR in #$NUMBER'
9+
categories:
10+
- title: '💥 Breaking Changes'
11+
labels:
12+
- 'changelog:breaking' # When a breaking change is introduced
13+
- title: '✨ Features'
14+
labels:
15+
- 'changelog:feature' # When a new feature is introduced
16+
- 'changelog:enhancement' # When an existing feature is improved
17+
- title: '🐛 Bug Fixes'
18+
labels:
19+
- 'changelog:fix' # When a bug is fixed
20+
- title: '📝 Documentation'
21+
labels:
22+
- 'changelog:docs' # When documentation is updated
23+
- title: '🧰 Maintenance'
24+
labels:
25+
- 'changelog:chore' # When a chore is done
26+
- 'changelog:ci' # When CI is updated
27+
- 'changelog:dependencies' # When dependencies are updated
28+
exclude-labels:
29+
- 'changelog:skip' # When a PR should be excluded from the changelog
30+
version-resolver:
31+
major:
32+
labels:
33+
- 'changelog:breaking'
34+
minor:
35+
labels:
36+
- 'changelog:feature'
37+
default: patch
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
# This workflow creates a major tag in the format of vX when a release is published.
3+
# E.g. if a release is published with the tag v1.1.0, this workflow will create a tag v1.
4+
name: create-major-tag
5+
6+
on:
7+
release:
8+
types:
9+
- published
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
create-major-tag:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Get major version
20+
run: |
21+
MAJOR_VERSION=$(echo "${GITHUB_REF#refs/tags/v}" | awk -F. '{print $1}')
22+
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> "${GITHUB_ENV}"
23+
- name: Create major tag
24+
run: |
25+
git tag "v${MAJOR_VERSION}"
26+
git push -f origin "refs/tags/v${MAJOR_VERSION}"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: release-drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
update-release-draft:
13+
permissions:
14+
contents: write
15+
pull-requests: read
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6.0.0
19+
env:
20+
GITHUB_TOKEN: ${{ github.token }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: required-labels
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- labeled
8+
- unlabeled
9+
- synchronize
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
check-labels:
16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- id: get-labels
23+
run: |
24+
labels=$(yq '[.categories[].labels] + .exclude-labels | flatten | unique | sort | @tsv' .github/release-drafter.yml | tr '\t' ',')
25+
echo "labels=$labels" >> "${GITHUB_OUTPUT}"
26+
- id: check-labels
27+
uses: mheap/github-action-required-labels@5847eef68201219cf0a4643ea7be61e77837bbce # v5.4.1
28+
with:
29+
mode: exactly
30+
count: 1
31+
use_regex: false
32+
add_comment: true
33+
labels: ${{ steps.get-labels.outputs.labels }}

0 commit comments

Comments
 (0)