mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-23 08:06:46 +00:00
Update Github release from changelog
This commit is contained in:
29
.github/workflows/github-release.yml
vendored
Normal file
29
.github/workflows/github-release.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Prepare release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'release-*'
|
||||
|
||||
jobs:
|
||||
prepare-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Prepare changelog
|
||||
id: changelog
|
||||
run: |
|
||||
PICARD_VERSION=$(python -c "import picard; print(picard.__version__)")
|
||||
echo "::set-output name=version::"$PICARD_VERSION
|
||||
./scripts/package/changelog-for-version.py $PICARD_VERSION > changes-$PICARD_VERSION.txt
|
||||
- name: Update release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: MusicBrainz Picard ${{ steps.changelog.outputs.version }}
|
||||
body_path: changes-${{ steps.changelog.outputs.version }}.txt
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
21
scripts/package/changelog-for-version.py
Executable file
21
scripts/package/changelog-for-version.py
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
print("Call with changelog-for-version.py [version]", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
version = sys.argv[1]
|
||||
re_changes = re.compile(r'^# Version ' + re.escape(version) + '.*?\n(.*?)# Version',
|
||||
re.DOTALL | re.MULTILINE)
|
||||
|
||||
with open('NEWS.md', 'r') as newsfile:
|
||||
news = newsfile.read()
|
||||
result = re_changes.search(news)
|
||||
if not result:
|
||||
print("No changelog found for version %s" % version, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
print(result[1].strip())
|
||||
Reference in New Issue
Block a user