build: replace custom release script with release-please (#2817)

* build: replace custom release script with release-please

* include package-name
This commit is contained in:
Jonas L 2023-12-22 19:19:12 +01:00 committed by GitHub
parent 3e06cc1072
commit e7a678e91f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 102 additions and 203 deletions

View File

@ -1,22 +0,0 @@
{{ range .Versions }}<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
- [Release note](https://libretime.org/docs/releases/{{ .Tag.Name }}/)
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range reverse .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}
{{ end -}}

View File

@ -1,25 +0,0 @@
style: github
template: CHANGELOG.md.tpl
info:
title: CHANGELOG
repository_url: https://github.com/libretime/libretime
options:
commits:
filters:
Type: [feat, fix, docs, test, ci]
sort_by: Date
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
docs: Documentation
test: Tests
ci: CI
sort_by: Custom
title_order: [feat, fix, docs, test, ci]
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject

20
.github/release-please-config.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"bootstrap-sha": "26737abad231d96fc198fbf12c043f2d867be79c",
"include-component-in-tag": false,
"include-v-in-tag": false,
"packages": {
".": {
"release-type": "simple",
"package-name": "libretime",
"extra-files": [
"analyzer/setup.py",
"api/setup.py",
"api-client/setup.py",
"playout/setup.py",
"shared/setup.py",
"worker/setup.py"
]
}
}
}

1
.github/release-please-manifest.json vendored Normal file
View File

@ -0,0 +1 @@
{".":"3.2.0"}

27
.github/workflows/backport.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Backport
on:
pull_request_target:
types:
- closed
- labeled
jobs:
backport:
runs-on: ubuntu-latest
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged
&& (
github.event.action == 'closed'
|| (
github.event.action == 'labeled'
&& contains(github.event.label.name, 'backport')
)
)
steps:
- uses: tibdex/backport@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

20
.github/workflows/release-please.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Release-Please
on:
push:
branches:
- main
- stable
jobs:
release-please:
# Do not run on forks.
if: github.repository == 'libretime/libretime'
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
with:
config-file: .github/release-please-config.json
manifest-file: .github/release-please-manifest.json
target-branch: ${{ github.ref_name }}

View File

@ -22,12 +22,9 @@ jobs:
- name: Build tarball
run: make tarball
- name: Create Release
- name: Upload tarball
uses: softprops/action-gh-release@v1
with:
body_path: docs/releases/${{ github.ref_name }}.md
draft: true
prerelease: true
files: |
libretime-*.tar.gz
sha256sums.txt

View File

@ -33,7 +33,7 @@ repos:
hooks:
- id: prettier
files: \.(md|mdx|yml|yaml|js|jsx|ts|tsx|json|css)$
exclude: ^legacy/public(?!/js/airtime)
exclude: ^(legacy/public(?!/js/airtime)|CHANGELOG.md$|.github/release-please-manifest.json)
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0

View File

@ -1,4 +1,4 @@
<a name="3.2.0"></a>
# Changelog
## [3.2.0](https://github.com/libretime/libretime/compare/3.1.0...3.2.0) (2023-10-16)
@ -38,8 +38,6 @@
- **playout:** check unsupported liquidsoap aac output
<a name="3.1.0"></a>
## [3.1.0](https://github.com/libretime/libretime/compare/3.0.2...3.1.0) (2023-05-26)
- [Release note](https://libretime.org/docs/releases/3.1.0/)
@ -230,8 +228,6 @@
- chore(api): install django-rest-framework from git ([#2518](https://github.com/libretime/libretime/issues/2518))
<a name="3.0.2"></a>
## [3.0.2](https://github.com/libretime/libretime/compare/3.0.1...3.0.2) (2023-02-21)
- [Release note](https://libretime.org/docs/releases/3.0.2/)
@ -263,8 +259,6 @@
- don't squash commits during docs sync
- test project weekly
<a name="3.0.1"></a>
## [3.0.1](https://github.com/libretime/libretime/compare/3.0.0...3.0.1) (2022-12-20)
- [Release note](https://libretime.org/docs/releases/3.0.1/)
@ -293,8 +287,6 @@
- sync docs with libretime/website repository
- pin vale version to v2.21.3
<a name="3.0.0"></a>
## [3.0.0](https://github.com/libretime/libretime/compare/3.0.0-beta.2...3.0.0) (2022-10-10)
- [Release note](https://libretime.org/docs/releases/3.0.0/)
@ -315,8 +307,6 @@
- **analyzer:** fix wrong bit_rate values
<a name="3.0.0-beta.2"></a>
## [3.0.0-beta.2](https://github.com/libretime/libretime/compare/3.0.0-beta.1...3.0.0-beta.2) (2022-10-03)
- [Release note](https://libretime.org/docs/releases/3.0.0-beta.2/)
@ -345,8 +335,6 @@
- allow failure when linting /docs/releases
- use github.ref_name to get tag
<a name="3.0.0-beta.1"></a>
## [3.0.0-beta.1](https://github.com/libretime/libretime/compare/3.0.0-beta.0...3.0.0-beta.1) (2022-09-23)
- [Release note](https://libretime.org/docs/releases/3.0.0-beta.1/)
@ -379,8 +367,6 @@
- don't check github.com/libretime/libretime/(issues|pulls) links
- run docs workflow on vale files changes
<a name="3.0.0-beta.0"></a>
## [3.0.0-beta.0](https://github.com/libretime/libretime/compare/3.0.0-alpha.13...3.0.0-beta.0) (2022-09-16)
- [Release note](https://libretime.org/docs/releases/3.0.0-beta.0/)
@ -530,8 +516,6 @@
- improve containers build caching
- add container tags
<a name="3.0.0-alpha.13"></a>
## [3.0.0-alpha.13](https://github.com/libretime/libretime/compare/3.0.0-alpha.12...3.0.0-alpha.13) (2022-07-15)
- [Release note](https://libretime.org/docs/releases/3.0.0-alpha.13/)
@ -692,8 +676,6 @@
- disable codecov project status check
- disable codecov patch status check
<a name="3.0.0-alpha.12"></a>
## [3.0.0-alpha.12](https://github.com/libretime/libretime/compare/3.0.0-alpha.11...3.0.0-alpha.12) (2022-03-29)
- [Release note](https://libretime.org/docs/releases/3.0.0-alpha.12/)
@ -708,8 +690,6 @@
- add missing data to release note
- fix and update links ([#1714](https://github.com/libretime/libretime/issues/1714))
<a name="3.0.0-alpha.11"></a>
## [3.0.0-alpha.11](https://github.com/libretime/libretime/compare/3.0.0-alpha.10...3.0.0-alpha.11) (2022-03-28)
- [Release note](https://libretime.org/docs/releases/3.0.0-alpha.11/)

View File

@ -31,9 +31,6 @@ dev: .env dev-certs
VERSION:
tools/version.sh
changelog:
tools/changelog.sh
.PHONY: tarball
tarball: VERSION
$(MAKE) -C legacy build

View File

@ -1,8 +1,10 @@
from setuptools import find_packages, setup
version = "3.2.0" # x-release-please-version
setup(
name="libretime-analyzer",
version="3.2.0",
version=version,
description="Libretime Analyzer",
author="LibreTime Contributors",
url="https://github.com/libretime/libretime",

View File

@ -1,8 +1,10 @@
from setuptools import find_packages, setup
version = "3.2.0" # x-release-please-version
setup(
name="libretime-api-client",
version="3.2.0",
version=version,
description="LibreTime API Client",
author="LibreTime Contributors",
url="https://github.com/libretime/libretime",

View File

@ -1,8 +1,10 @@
from setuptools import find_packages, setup
version = "3.2.0" # x-release-please-version
setup(
name="libretime-api",
version="3.2.0",
version=version,
description="LibreTime API",
author="LibreTime Contributors",
url="https://github.com/libretime/libretime",

View File

@ -6,47 +6,17 @@ title: Releases
This guide walks you through the steps required to release a new version of LibreTime.
:::caution
### 1. Inspect the release pull request
This guide is still a work in progress, and doesn't cover every use cases. Depending on
the version bump, some steps might be wrong. For example, in case of a patch release,
the documentation requires different changes.
A release pull request is maintained by [`release-please`](https://github.com/googleapis/release-please). `release-please` guesses the next version to release based on the commit history, and will generate a changelog for that release.
:::
Before releasing a new version, make sure linter don't fail and tests are passing.
Start by cleaning the repository and make sure you don't have uncommitted changes:
```
git checkout main
make clean
git status
```
Choose the next version based the our [versioning schema](#versioning-schema):
Once a release is desired, checkout the release branch:
```bash
export VERSION=3.0.0-beta.0
```
Create a new `release-$VERSION` branch and release commit to prepare a release pull request:
```bash
git checkout -b "release-$VERSION"
export COMMIT_MESSAGE="chore: release $VERSION"
git commit --allow-empty --message="$COMMIT_MESSAGE"
```
### 1. Version bump
Write the new `$VERSION` to the VERSION file, and bump the python packages version:
```bash
bash tools/bump-python-version.sh "$VERSION"
git add .
git commit --fixup ":/$COMMIT_MESSAGE"
# For a release on the main branch
git checkout release-please--branches--main--components--libretime
# For a release on the stable branch
git checkout release-please--branches--stable--components--libretime
```
### 2. Release note
@ -72,48 +42,16 @@ Reset and clean the `docs/releases/unreleased.md` file for a future version.
Commit the release note changes:
```bash
git add .
git commit --fixup ":/$COMMIT_MESSAGE"
git add docs/releases
git commit -m "docs: add release note"
```
### 3. Create a new pull request
### 4. Merge the release pull request
Squash the changes and open a pull request for others to review:
Push any changes that we previously made to the release branch:
```bash
git rebase --autosquash --interactive main
git push
```
Merge the pull request when it's reviewed and ready.
### 4. Create and push a tag
Pull the merged release commit:
```bash
git checkout main
git pull upstream main
```
Make sure `HEAD` is the previously merged release commit and tag it with the new version:
```bash
git show --quiet
git tag -a -m "$VERSION" "$VERSION"
```
Generate the changelog for the newly tagged version:
```bash
make changelog
git add .
git commit -m "chore: generate changelog for $VERSION"
```
Push the tag upstream to finalize the release process:
```bash
git push upstream main --follow-tags
```
Once the pull request CI succeeded and everything is ready, merge the release pull request. `release-please` will create a tag and a release, which will trigger the final release pipeline that will upload the tarball as release assets.

View File

@ -1,8 +1,10 @@
from setuptools import find_packages, setup
version = "3.2.0" # x-release-please-version
setup(
name="libretime-playout",
version="3.2.0",
version=version,
description="LibreTime Playout",
author="LibreTime Contributors",
url="https://github.com/libretime/libretime",

View File

@ -1,8 +1,10 @@
from setuptools import find_packages, setup
version = "3.2.0" # x-release-please-version
setup(
name="libretime-shared",
version="3.2.0",
version=version,
description="LibreTime Shared",
url="https://github.com/libretime/libretime",
author="LibreTime Contributors",

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
# Bump the version in the setup.py files.
set -u
error() {
echo >&2 "error: $*"
exit 1
}
command -v sed > /dev/null || error "sed command not found!"
version="$1"
for setup_path in */setup.py; do
sed --in-place \
"s/version=\".*\",/version=\"$version\",/" \
"$setup_path" ||
error "could not bump version for $setup_path!"
done

View File

@ -1,25 +0,0 @@
#!/usr/bin/env bash
set -u
error() {
echo >&2 "error: $*"
exit 1
}
command -v git > /dev/null || error "git command not found!"
command -v git-chglog > /dev/null || error "git-chglog command not found!"
changelog="CHANGELOG.md"
tag="${tag:-$(git describe --abbrev=0 --tags || error "could not extract latest tag")}"
if grep --quiet "<a name=\"$tag\"></a>" "$changelog"; then
error "changelog has already been generated for tag $tag!"
fi
cat <(git-chglog "$tag") "$changelog" > "$changelog.tmp"
mv "$changelog.tmp" "$changelog"
if command -v npx > /dev/null; then
npx prettier --write "$changelog"
fi

View File

@ -1,8 +1,10 @@
from setuptools import find_packages, setup
version = "3.2.0" # x-release-please-version
setup(
name="libretime-worker",
version="3.2.0",
version=version,
description="LibreTime Worker",
author="LibreTime Contributors",
url="https://github.com/libretime/libretime",