Skip to content

Commit a4a03f1

Browse files
committed
Add release action
1 parent c59b394 commit a4a03f1

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release new version
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
7+
jobs:
8+
pypi-publish:
9+
name: Upload release to PyPI
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/tinycss2
14+
permissions:
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
- name: Install requirements
20+
run: python -m pip install flit
21+
- name: Build packages
22+
run: flit build
23+
- name: Publish package distributions to PyPI
24+
uses: pypa/gh-action-pypi-publish@release/v1
25+
add-version:
26+
name: Add version to GitHub
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: write
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
- name: Install requirements
34+
run: sudo apt-get install pandoc
35+
- name: Generate content
36+
run: |
37+
pandoc docs/changelog.rst -f rst -t gfm | csplit - /##/ "{1}" -f .part
38+
sed -r "s/^([A-Z].*)\:\$/## \1/" .part01 | sed -r "s/^ *//" | sed -rz "s/([^\n])\n([^\n^-])/\1 \2/g" | tail -n +5 > .body
39+
- name: Create Release
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
body_path: .body

0 commit comments

Comments
 (0)