-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (76 loc) · 2.26 KB
/
pypi.yml
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
name: Build and Deploy to PyPI
on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
PYPI_USERNAME:
required: true
PYPI_PASSWORD:
required: true
jobs:
build_and_deploy:
name: Build and Deploy to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
# Versioning is handled in setup.py
- name: Build distribution
run: python setup.py sdist bdist_wheel
- name: Upload to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
pull_and_test:
name: Pull and Test PyPI Package
needs: build_and_deploy
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install package from PyPI
run: |
python -m pip install --upgrade pip
pip install phase-cli
- name: Test installed package (Linux/macOS)
if: runner.os != 'Windows'
run: |
installed_version=$(phase -v)
echo "Installed version: $installed_version"
echo "Expected version: ${{ inputs.version }}"
if [ "$installed_version" != "${{ inputs.version }}" ]; then
echo "Version mismatch!"
exit 1
fi
- name: Test installed package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$installed_version = phase -v
echo "Installed version: $installed_version"
echo "Expected version: ${{ inputs.version }}"
if ($installed_version -ne "${{ inputs.version }}") {
echo "Version mismatch!"
exit 1
}