Skip to content

Commit 3660eb6

Browse files
authored
Merge pull request #95 from QuLogic/auto-publish
Add a release workflow to publish to PyPI
2 parents 98a09db + 245c886 commit 3660eb6

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
18+
- name: Set up Python
19+
id: setup
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.x
23+
24+
- name: Install build tools
25+
run: |
26+
python -m pip install --upgrade pip
27+
python -m pip install --upgrade build
28+
29+
- name: Build packages
30+
run: python -m build
31+
32+
- name: Save built packages as artifact
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: packages-${{ runner.os }}-${{ steps.setup.outputs.python-version }}
36+
path: dist/
37+
if-no-files-found: error
38+
retention-days: 5
39+
40+
publish:
41+
name: Upload release to PyPI
42+
needs: build
43+
runs-on: ubuntu-latest
44+
environment: release
45+
permissions:
46+
id-token: write
47+
steps:
48+
- name: Download packages
49+
uses: actions/download-artifact@v3
50+
51+
- name: Consolidate packages for upload
52+
run: |
53+
mkdir dist
54+
cp packages-*/* dist/
55+
56+
- name: Publish package distributions to PyPI
57+
uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e # v1.8.10

0 commit comments

Comments
 (0)