-
Notifications
You must be signed in to change notification settings - Fork 110
126 lines (103 loc) · 3.43 KB
/
deploy_pkg.yml
File metadata and controls
126 lines (103 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: CI deploy package
on:
release:
types:
- published
workflow_dispatch:
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0 # Required for dynamic versioning
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tools
run: |
python -m pip install --upgrade pip build twine
- name: Build package
run: python -m build
- name: Check package metadata
run: twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: DoubleML-pkg
path: dist/
publish-to-testpypi:
name: Publish to TestPyPI 🧪
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/DoubleML
permissions:
id-token: write
steps:
- name: Download built package
uses: actions/download-artifact@v4
with:
name: DoubleML-pkg
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true # Prevents failure on re-runs
verify-testpypi:
name: Verify TestPyPI Install 🕵️
needs: publish-to-testpypi
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Wait for TestPyPI indexing
run: sleep 60
- name: Install from TestPyPI
# --extra-index-url allows pip to find dependencies (pandas, numpy) on the real PyPI
if: github.event_name == 'release'
run: pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "DoubleML==${{ github.ref_name }}"
- name: Install from TestPyPI (workflow_dispatch)
# For manual runs, install the latest pre-release version
if: github.event_name == 'workflow_dispatch'
run: pip install --pre --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ DoubleML
- name: Import Smoke Test
run: python -c "import doubleml; print(f'Successfully imported DoubleML version {doubleml.__version__}')"
publish-to-pypi:
name: Publish to PyPI 🚀
needs: verify-testpypi
runs-on: ubuntu-latest
if: github.event_name == 'release' # Do not publish on workflow_dispatch
environment:
name: pypi
url: https://pypi.org/p/DoubleML
permissions:
id-token: write
steps:
- name: Download built package
uses: actions/download-artifact@v4
with:
name: DoubleML-pkg
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
verify-pypi:
name: Verify PyPI Install 🕵️
needs: publish-to-pypi
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Wait for PyPI indexing
run: sleep 60
- name: Install from PyPI
run: pip install "DoubleML==${{ github.ref_name }}"
- name: Import Smoke Test
run: python -c "import doubleml; print(f'Successfully imported DoubleML version {doubleml.__version__}')"