Skip to content

Commit 58340cf

Browse files
committed
workflow for publishing to test
1 parent 17c96a2 commit 58340cf

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/test-publish.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish to TestPyPI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- master
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
21+
- name: Install build tools
22+
run: |
23+
python -m pip install --upgrade build
24+
25+
- name: Build the package
26+
run: |
27+
python -m build
28+
29+
- name: Upload built package as artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: package-distributions
33+
path: dist/
34+
35+
publish:
36+
runs-on: ubuntu-latest
37+
needs: build # Only publish if build succeeds
38+
permissions:
39+
id-token: write
40+
environment:
41+
name: testpypi
42+
url: "https://test.pypi.org/p/mccann_hub-odoo_client_lib"
43+
steps:
44+
- name: Download built package
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: package-distributions
48+
path: dist/
49+
50+
- name: Publish to TestPyPI
51+
uses: pypa/gh-action-pypi-publish@release/v1
52+
with:
53+
repository-url: "https://test.pypi.org/legacy/"
54+
skip-existing: true
55+
verbose: true
56+
57+
verify:
58+
runs-on: ubuntu-latest
59+
needs: publish # Only verify if TestPyPI upload succeeds
60+
steps:
61+
- name: Install package from TestPyPI
62+
run: |
63+
python -m pip install \
64+
--index-url https://test.pypi.org/simple/ \
65+
--extra-index-url https://pypi.org/simple/ \
66+
mccann_hub-odoo_client_lib
67+
68+
- name: Verify import
69+
run: |
70+
python -c "import mccann_hub.odoolib; print('✅ Import successful')"

0 commit comments

Comments
 (0)