Skip to content

Commit e032195

Browse files
authored
Merge pull request #74 from QuLogic/pypi-publish
Add a release workflow to publish to PyPI
2 parents 44e80c8 + 0af7474 commit e032195

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

Diff for: .github/workflows/release.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
3+
name: Release
4+
on:
5+
release:
6+
types:
7+
- published
8+
9+
jobs:
10+
build:
11+
name: Build Release Packages
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 10
17+
fetch-tags: true
18+
19+
- name: Set up Python
20+
id: setup
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: 3.x
24+
25+
- name: Install build tools
26+
run: |
27+
python -m pip install --upgrade pip
28+
python -m pip install --upgrade build
29+
30+
- name: Build packages
31+
run: python -m build
32+
33+
- name: Save built packages as artifact
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: packages-${{ runner.os }}-${{ steps.setup.outputs.python-version }}
37+
path: dist/
38+
if-no-files-found: error
39+
retention-days: 5
40+
41+
publish:
42+
name: Upload release to PyPI
43+
needs: build
44+
runs-on: ubuntu-latest
45+
environment: release
46+
permissions:
47+
id-token: write
48+
steps:
49+
- name: Download packages
50+
uses: actions/download-artifact@v3
51+
52+
- name: Consolidate packages for upload
53+
run: |
54+
mkdir dist
55+
cp packages-*/* dist/
56+
57+
- name: Publish package distributions to PyPI
58+
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10

0 commit comments

Comments
 (0)