Spaces:
Runtime error
Runtime error
Mayuresh Agashe
commited on
Commit
Β·
6899114
1
Parent(s):
7e6f93a
Create build_python_package.yml (#20)
Browse files
.github/workflows/build_python_package.yml
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Publish Python π distribution π¦ to PyPI and run tests
|
2 |
+
|
3 |
+
|
4 |
+
on:
|
5 |
+
workflow_dispatch:
|
6 |
+
|
7 |
+
release:
|
8 |
+
types: [created]
|
9 |
+
|
10 |
+
|
11 |
+
jobs:
|
12 |
+
build:
|
13 |
+
if: github.repository == 'CaffeineCrew/Techdocs'
|
14 |
+
runs-on: ubuntu-latest
|
15 |
+
steps:
|
16 |
+
- uses: actions/checkout@v3
|
17 |
+
- name: Set up Python 3.10
|
18 |
+
uses: actions/setup-python@v3
|
19 |
+
with:
|
20 |
+
python-version: "3.10"
|
21 |
+
|
22 |
+
- name: Install package-dependencies
|
23 |
+
- run: |
|
24 |
+
python -m pip install --upgrade pip
|
25 |
+
pip install setuptools wheel
|
26 |
+
|
27 |
+
- name: build package
|
28 |
+
- run: |
|
29 |
+
python python setup.py sdist bdist_wheel
|
30 |
+
- name: Store dist as an artifact
|
31 |
+
- uses: actions/upload-artifact@v3
|
32 |
+
- with:
|
33 |
+
name: python-package
|
34 |
+
path: dist/
|
35 |
+
|
36 |
+
|
37 |
+
publish_package_to_testpypi:
|
38 |
+
if: github.repository == 'CaffeineCrew/Techdocs'
|
39 |
+
needs: build
|
40 |
+
runs-on: ubuntu-latest
|
41 |
+
steps:
|
42 |
+
- uses: actions/checkout@v3
|
43 |
+
- name: Set up Python 3.10
|
44 |
+
uses: actions/setup-python@v3
|
45 |
+
with:
|
46 |
+
python-version: "3.10"
|
47 |
+
- name: Install dependencies
|
48 |
+
run: |
|
49 |
+
python -m pip install --upgrade pip
|
50 |
+
pip install twine
|
51 |
+
|
52 |
+
- name: Publish π¦ to testpypi
|
53 |
+
env:
|
54 |
+
TESETPYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
55 |
+
TESTPYPI_CLI: ${{ secrets.PYPI_PASSWORD }}
|
56 |
+
- uses: actions/download-artifact@v3
|
57 |
+
- with:
|
58 |
+
name: python-package
|
59 |
+
- run: |
|
60 |
+
twine upload -r testpypi dist/*
|
61 |
+
|
62 |
+
|
63 |
+
run_tests:
|
64 |
+
needs: [build, publish_package_to_testpypi]
|
65 |
+
runs-on: ubuntu-latest
|
66 |
+
steps:
|
67 |
+
- working-directory: /techdocs
|
68 |
+
- uses: actions/checkout@v3
|
69 |
+
- name: Set up Python 3.10
|
70 |
+
uses: actions/setup-python@v3
|
71 |
+
with:
|
72 |
+
python-version: "3.10"
|
73 |
+
- name: Install dependencies
|
74 |
+
run: |
|
75 |
+
python -m pip install --upgrade pip
|
76 |
+
pip install --no-cache-dir --index-url https://test.pypi.org/simple/ --extra-index-url=https://pypi.org/simple/ techdocs
|
77 |
+
|
78 |
+
- name: Test testpypi package
|
79 |
+
run: |
|
80 |
+
techdocs run tests
|
81 |
+
|
82 |
+
|
83 |
+
publish_package_to_pypi:
|
84 |
+
needs: [build, publish_package_to_testpypi, run_tests]
|
85 |
+
if: github.repository == 'CaffeineCrew/Techdocs'
|
86 |
+
runs-on: ubuntu-latest
|
87 |
+
steps:
|
88 |
+
- uses: actions/checkout@v3
|
89 |
+
- name: Set up Python 3.10
|
90 |
+
uses: actions/setup-python@v3
|
91 |
+
with:
|
92 |
+
python-version: "3.10"
|
93 |
+
|
94 |
+
- name: Publish π¦ to pypi
|
95 |
+
env:
|
96 |
+
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
97 |
+
PYPI_CLI: ${{ secrets.PYPI_PASSWORD }}
|
98 |
+
- uses: actions/download-artifact@v3
|
99 |
+
- with:
|
100 |
+
name: python-package
|
101 |
+
- run: |
|
102 |
+
twine upload dist/*
|
103 |
+
pip install techdocs --upgrade
|
104 |
+
|