-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (87 loc) · 2.72 KB
/
build_python_package.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Publish Python 🐍 distribution 📦 to PyPI and run tests
on:
workflow_dispatch:
release:
types: [created]
jobs:
build:
if: github.repository == 'CaffeineCrew/Techdocs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install package-dependencies
- run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: build package
- run: |
python python setup.py sdist bdist_wheel
- name: Store dist as an artifact
- uses: actions/upload-artifact@v3
- with:
name: python-package
path: dist/
publish_package_to_testpypi:
if: github.repository == 'CaffeineCrew/Techdocs'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine
- name: Publish 📦 to testpypi
env:
TESETPYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
TESTPYPI_CLI: ${{ secrets.PYPI_PASSWORD }}
- uses: actions/download-artifact@v3
- with:
name: python-package
- run: |
twine upload -r testpypi dist/*
run_tests:
needs: [build, publish_package_to_testpypi]
runs-on: ubuntu-latest
steps:
- working-directory: /techdocs
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir --index-url https://test.pypi.org/simple/ --extra-index-url=https://pypi.org/simple/ techdocs
- name: Test testpypi package
run: |
techdocs run tests
publish_package_to_pypi:
needs: [build, publish_package_to_testpypi, run_tests]
if: github.repository == 'CaffeineCrew/Techdocs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Publish 📦 to pypi
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_CLI: ${{ secrets.PYPI_PASSWORD }}
- uses: actions/download-artifact@v3
- with:
name: python-package
- run: |
twine upload dist/*
pip install techdocs --upgrade