Skip to content

Commit 55e2f92

Browse files
author
Sam Daniel Thangarajan
committed
add jobs to publish package to pypi and testpypi
1 parent ee4a3b7 commit 55e2f92

File tree

1 file changed

+72
-28
lines changed

1 file changed

+72
-28
lines changed

.github/workflows/wf-push.yml

Lines changed: 72 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,89 @@ jobs:
3333
- name: Run build
3434
run: tox -e build
3535

36+
- name: Build doc
37+
run: tox -e doc
38+
39+
- name: Store the distribution packages
40+
uses: actions/upload-artifact@v5
41+
with:
42+
name: build-artifacts-${{ matrix.python-version }}
43+
path: |
44+
dist/
45+
docs/
46+
47+
3648
deploy-docs:
37-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
38-
strategy:
39-
fail-fast: false
40-
matrix:
41-
python-version: [ "3.10"]
49+
name: Deploy documentation 📚 to GitHub Pages
50+
if: startsWith(github.ref, 'refs/tags/') # only publish documentation on tag pushes
51+
needs:
52+
- build
4253
runs-on: ubuntu-latest
43-
needs: build
44-
permissions:
45-
contents: write
46-
pages: write
54+
4755
environment:
4856
name: github-pages
4957
url: ${{ steps.deployment.outputs.page_url }}
50-
steps:
51-
- name: Checkout
52-
uses: actions/checkout@v4
53-
54-
- name: Set up Python ${{ matrix.python-version }}
55-
uses: actions/setup-python@v3
56-
with:
57-
python-version: ${{ matrix.python-version }}
5858

59-
- name: Setup Pages
60-
uses: actions/configure-pages@v4
61-
62-
- name: Upgrade pip
63-
run: python -m pip install --upgrade pip
64-
65-
- name: Install Tox
66-
run: pip install tox
59+
permissions:
60+
contents: write
61+
pages: write
6762

68-
- name: Build Doc
69-
run: tox -e doc
63+
steps:
64+
- name: Download docs build artifacts
65+
uses: actions/download-artifact@v6
66+
with:
67+
name: build-artifacts-3.12
68+
path: docs/
7069

7170
- name: Deploy to GitHub Pages
7271
uses: peaceiris/actions-gh-pages@v3
7372
with:
7473
publish_branch: gh-pages
7574
github_token: ${{ secrets.GITHUB_TOKEN }}
7675
publish_dir: docs/_build/html
77-
force_orphan: true
76+
force_orphan: true
77+
78+
publish-to-testpypi:
79+
name: Publish Python 🐍 distribution 📦 to TestPyPI
80+
needs:
81+
- build
82+
runs-on: ubuntu-latest
83+
84+
environment:
85+
name: testpypi
86+
url: https://test.pypi.org/p/nasdaq-protocols
87+
88+
permissions:
89+
id-token: write
90+
91+
steps:
92+
- name: Download all the dists
93+
uses: actions/download-artifact@v6
94+
with:
95+
name: build-artifacts-3.12
96+
path: dist/
97+
- name: Publish distribution 📦 to TestPyPI
98+
uses: pypa/gh-action-pypi-publish@release/v1
99+
with:
100+
repository-url: https://test.pypi.org/legacy/
101+
102+
publish-to-pypi:
103+
name: >-
104+
Publish Python 🐍 distribution 📦 to PyPI
105+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
106+
needs:
107+
- publish-to-testpypi # only publish to PyPI after TestPyPI publishing
108+
runs-on: ubuntu-latest
109+
environment:
110+
name: pypi
111+
url: https://pypi.org/p/nasdaq-protocols
112+
permissions:
113+
id-token: write
114+
steps:
115+
- name: Download all the dists
116+
uses: actions/download-artifact@v6
117+
with:
118+
name: build-artifacts-3.12
119+
path: dist/
120+
- name: Publish distribution 📦 to PyPI
121+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)