Skip to content

Commit 1df5344

Browse files
authored
Set up release-drafter (#202)
The following information was also added to the README.md # Release Process This section outlines the process for releasing a new version of this project. ## Versioning This project uses [Semantic Versioning](https://semver.org/) and its version is automatically determined by [release-drafter](https://github.com/release-drafter/release-drafter) based on the labels of the pull requests merged into the `main` branch. See the [release-drafter configuration](../.github/release-drafter.yml) for more details. ## Creating a New Release Every time a pull request is merged into the `main` branch, release-drafter will create a draft release or update the existing draft release in the [Releases](https://github.com/elastic/docs-builder/releases) page. To create a new release you need to publish the existing draft release created by release-drafter. > [!IMPORTANT] > Make sure the [release-drafter workflow](../.github/workflows/release-drafter.yml) is finished before publishing the release. > [!NOTE] > When a release is published, the [create-major-tag workflow](../.github/workflows/create-major-tag.yml) > will force push a new major tag in the format `vX` where `X` is the major version of the release. > For example, if the release is `v1.2.3` was published, the workflow will force push a new tag `v1` on the same commit.
1 parent a9425a9 commit 1df5344

File tree

5 files changed

+145
-0
lines changed

5 files changed

+145
-0
lines changed

.github/release-drafter.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 $RESOLVED_VERSION'
7+
tag-template: '$RESOLVED_VERSION'
8+
change-template: '- $TITLE by @$AUTHOR in #$NUMBER'
9+
categories:
10+
- title: '💥 Breaking Changes'
11+
labels:
12+
- 'breaking' # When a breaking change is introduced
13+
- title: '✨ Features'
14+
labels:
15+
- 'feature' # When a new feature is introduced
16+
- 'enhancement' # When an existing feature is improved
17+
- title: '🐛 Bug Fixes'
18+
labels:
19+
- 'bug' # When a bug is fixed
20+
- 'fix' # When a bug is fixed
21+
- title: '📝 Documentation'
22+
labels:
23+
- 'documentation' # When documentation is updated
24+
- title: '🧰 Maintenance'
25+
labels:
26+
- 'chore' # When a chore is done
27+
- 'ci' # When CI is updated
28+
- 'dependencies' # When dependencies are updated
29+
exclude-labels:
30+
- 'changelog:skip' # When a PR should be excluded from the changelog
31+
version-resolver:
32+
major:
33+
labels:
34+
- 'breaking'
35+
minor:
36+
labels:
37+
- 'feature'
38+
- 'enhancement'
39+
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/}" | 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 }}

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,30 @@ To test performance it's best to build the binary and run outside of docker:
136136

137137
For reference here's the `markitpy-doc` docset (50k markdown files) currently takes `14s` vs `several minutes` compared to
138138
existing surveyed tools
139+
140+
# Release Process
141+
142+
This section outlines the process for releasing a new version of this project.
143+
144+
## Versioning
145+
146+
This project uses [Semantic Versioning](https://semver.org/) and its version is
147+
automatically determined by [release-drafter](https://github.com/release-drafter/release-drafter)
148+
based on the labels of the pull requests merged into the `main` branch.
149+
150+
See the [release-drafter configuration](../.github/release-drafter.yml) for more details.
151+
152+
## Creating a New Release
153+
154+
Every time a pull request is merged into the `main` branch, release-drafter will
155+
create a draft release or update the existing draft release in the [Releases](https://github.com/elastic/docs-builder/releases) page.
156+
157+
To create a new release you need to publish the existing draft release created by release-drafter.
158+
159+
> [!IMPORTANT]
160+
> Make sure the [release-drafter workflow](../.github/workflows/release-drafter.yml) is finished before publishing the release.
161+
162+
> [!NOTE]
163+
> When a release is published, the [create-major-tag workflow](../.github/workflows/create-major-tag.yml)
164+
> will force push a new major tag in the format `vX` where `X` is the major version of the release.
165+
> For example, if the release is `1.2.3` was published, the workflow will force push a new tag `v1` on the same commit.

0 commit comments

Comments
 (0)