Skip to content

Commit 79ec936

Browse files
authored
Merge pull request #21 from jaqx0r/release
ci: Add a release workflow config.
2 parents ba7dc36 + 44fa60c commit 79ec936

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: release
2+
on:
3+
# Always test on pull_request, but do not do release (see check for tag below)
4+
pull_request:
5+
push:
6+
tags:
7+
- v*
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
16+
- run: git fetch --force --tags
17+
- uses: actions/setup-python@v4
18+
- run: sudo apt-get install -y libmad0-dev
19+
- run: python -m pip install --upgrade pip
20+
- run: python -m pip install build
21+
- run: python -m build --sdist --wheel --outdir dist/
22+
- uses: actions/upload-artifact@v1
23+
with:
24+
name: dist
25+
path: dist
26+
27+
28+
release:
29+
needs: build
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: softprops/action-gh-release@v1
36+
# Only on a tag
37+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
38+
with:
39+
generate_release_notes: true
40+
files: |
41+
dist/*.tar.gz
42+
dist/*.whl
43+
44+
publish:
45+
needs: [build, release]
46+
runs-on: ubuntu-latest
47+
permissions:
48+
id-token: write
49+
steps:
50+
- uses: actions/download-artifact@v3
51+
with:
52+
name: dist
53+
path: dist
54+
- uses: pypa/gh-action-pypi-publish@release/v1
55+
# Only on a tag
56+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')

0 commit comments

Comments
 (0)