Skip to content

Commit 48936a7

Browse files
authored
Merge pull request #374 from DoubleML/sk-add-publish-workflows
Deployment workflow for package publishing
2 parents 9575229 + 97417f6 commit 48936a7

File tree

1 file changed

+61
-20
lines changed

1 file changed

+61
-20
lines changed

.github/workflows/deploy_pkg.yml

Lines changed: 61 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,74 @@ on:
55
types:
66
- published
77

8-
98
jobs:
109
build:
11-
10+
name: Build distribution 📦
1211
runs-on: ubuntu-latest
1312

1413
steps:
15-
- uses: actions/checkout@v4
16-
with:
17-
persist-credentials: false
14+
- uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
18+
- name: Install python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install build tools
24+
run: |
25+
python -m pip install --upgrade pip build twine
26+
27+
- name: Build package
28+
run: python -m build
29+
30+
- name: Check package metadata
31+
run: twine check dist/*
1832

19-
- name: Install python
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: '3.12'
33+
- uses: actions/upload-artifact@v4
34+
with:
35+
name: DoubleML-pkg
36+
path: dist/
2337

24-
- name: Install build tools
25-
run: |
26-
python -m pip install --upgrade pip build twine
38+
publish-to-testpypi:
39+
name: Publish to TestPyPI 🧪
40+
needs: build
41+
runs-on: ubuntu-latest
42+
environment:
43+
name: testpypi
44+
url: https://test.pypi.org/p/DoubleML
45+
permissions:
46+
id-token: write
47+
48+
steps:
49+
- name: Download built package
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: DoubleML-pkg
53+
path: dist/
2754

28-
- name: Build package
29-
run: python -m build
55+
- name: Publish to TestPyPI
56+
uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
repository-url: https://test.pypi.org/legacy/
3059

31-
- name: Check package metadata
32-
run: twine check dist/*
60+
publish-to-pypi:
61+
name: Publish to PyPI 🚀
62+
needs: publish-to-testpypi
63+
runs-on: ubuntu-latest
64+
environment:
65+
name: pypi
66+
url: https://pypi.org/p/DoubleML
67+
permissions:
68+
id-token: write
69+
70+
steps:
71+
- name: Download built package
72+
uses: actions/download-artifact@v4
73+
with:
74+
name: DoubleML-pkg
75+
path: dist/
3376

34-
- uses: actions/upload-artifact@v4
35-
with:
36-
name: DoubleML-pkg
37-
path: dist/
77+
- name: Publish to PyPI
78+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)