-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.16 KB
/
release.yml
File metadata and controls
43 lines (35 loc) · 1.16 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
- name: Extract changelog for this version
id: changelog
run: |
# Extract the section for this version from CHANGELOG.md
version="${GITHUB_REF#refs/tags/v}"
awk "/^## \\[${version}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md > /tmp/release-notes.md
echo "Release notes:"
cat /tmp/release-notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.version.outputs.version }}
body_path: /tmp/release-notes.md
draft: false
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'beta') }}
- name: Build package
run: pip install build && python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1