Skip to content

Commit 4502fd4

Browse files
authored
Merge pull request #87 from espdev/pypi-deployment-pipeline
Add pipeline for publishing the package to PyPI
2 parents e19ee61 + 5831c43 commit 4502fd4

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/pypi.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish to PyPI
2+
3+
on: workflow_dispatch
4+
5+
permissions:
6+
actions: write
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout project
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.11"
20+
21+
- name: Install Poetry
22+
uses: abatilo/actions-poetry@v4
23+
with:
24+
poetry-version: "1.8.5"
25+
26+
- name: Setup a local virtual environment
27+
run: |
28+
poetry config virtualenvs.create true --local
29+
poetry config virtualenvs.in-project true --local
30+
31+
- name: Define a cache for the virtual environment based on the dependencies lock file
32+
uses: actions/cache@v4
33+
with:
34+
path: ./.venv
35+
key: venv-${{ hashFiles('poetry.lock') }}
36+
37+
- name: Build
38+
run: poetry build
39+
40+
- name: Upload build artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: csaps-packages
44+
path: dist/*
45+
overwrite: true
46+
47+
upload:
48+
name: Upload to PyPI
49+
needs: [ build ]
50+
runs-on: ubuntu-latest
51+
environment:
52+
name: pypi
53+
url: https://pypi.org/project/csaps
54+
permissions:
55+
id-token: write
56+
57+
steps:
58+
- uses: actions/download-artifact@v4
59+
with:
60+
name: csaps-packages
61+
path: dist
62+
- name: Publish package to PyPI
63+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)