-
Notifications
You must be signed in to change notification settings - Fork 443
86 lines (81 loc) · 2.53 KB
/
Copy pathpublish-pypi.yml
File metadata and controls
86 lines (81 loc) · 2.53 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
name: Publish to PyPi
# Builds the package, checks wheel structure, publishes to TestPyPI, runs smoke
# tests against TestPyPI, then publishes to real PyPI only if all prior steps pass.
on:
release:
types: [published]
workflow_dispatch:
push:
tags:
- 'v*.*.*'
jobs:
build:
name: Build and check wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Build dist files
run: |
python -m pip install --upgrade pip
python -m pip install -e .[test] build
python -m build
git describe --tag --dirty --always
- name: Check wheel structure
run: python -m pytest test/test_packaging.py -m packaging -v
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish-test-pypi:
name: Publish to Test PyPI
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
smoke-test-pypi:
name: Smoke test from Test PyPI
needs: publish-test-pypi
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.x']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install from Test PyPI
run: |
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ tableauserverclient
- name: Smoke test
run: |
python -c "import tableauserverclient as TSC; server = TSC.Server('http://example.com', use_server_version=False)"
publish-pypi:
name: Publish to PyPI
needs: smoke-test-pypi
if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # license BSD-2
with:
password: ${{ secrets.PYPI_API_TOKEN }}