-
Notifications
You must be signed in to change notification settings - Fork 3
71 lines (61 loc) · 1.82 KB
/
pypi_publish.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
name: Build Wheels and upload to PyPI
on:
pull_request:
branches: ["releases/**"]
types: [labeled, opened, synchronize, reopened]
release:
types: [published]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
test:
name: Test
permissions:
contents: read
secrets: inherit
uses: ./.github/workflows/test.yml
build_wheels_sdist:
needs: [test]
name: Build
uses: ./.github/workflows/build.yml
secrets: inherit
test_pypi_publish:
# Test PyPI publish, requires wheels and source dist (sdist)
name: Publish ${{ github.repository }} to TestPyPI
needs: [test, build_wheels_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: distributions
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1.8
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/
verbose: true
pypi_publish:
name: Publish ${{ github.repository }} to to PyPI
needs: [test_pypi_publish]
runs-on: ubuntu-latest
# Publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: distributions
path: dist
- name: PYPI Publish
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist/
verbose: true