Skip to content

Commit a7fdd19

Browse files
authored
Configure GitHub actions to publish packages (#418)
* Configure GitHub actions to publish packages * Relax release restriction for testing * Revert "Relax release restriction for testing" This reverts commit 798b106 so releases will be the only event which triggers a build.
1 parent 34d25e7 commit a7fdd19

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/pypi-release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "PyPI releases"
2+
3+
on: release
4+
5+
jobs:
6+
build_sdist:
7+
name: Build Python source distribution
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Build sdist
13+
run: pipx run build --sdist
14+
15+
- uses: actions/upload-artifact@v3
16+
with:
17+
path: dist/*.tar.gz
18+
19+
pypi-publish:
20+
name: Upload release to PyPI
21+
if: github.event_name == 'release' && github.event.action == 'published'
22+
needs:
23+
- build_sdist
24+
runs-on: ubuntu-latest
25+
environment:
26+
name: pypi
27+
url: https://pypi.org/p/pysolr
28+
permissions:
29+
id-token: write
30+
steps:
31+
- uses: actions/download-artifact@v3
32+
with:
33+
# unpacks default artifact into dist/
34+
# if `name: artifact` is omitted, the action will create extra parent dir
35+
name: artifact
36+
path: dist
37+
- name: Publish package distributions to PyPI
38+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)