@@ -2,6 +2,8 @@ name: Python Build, Lint
2
2
3
3
on :
4
4
push :
5
+ release :
6
+ types : [published]
5
7
6
8
jobs :
7
9
build-test-lint :
16
18
17
19
- name : Set up Python environment
18
20
uses : actions/setup-python@v5
19
- with :
21
+ with :
20
22
python-version : ' 3.8'
21
23
cache : ' pip'
22
24
@@ -29,11 +31,11 @@ jobs:
29
31
sudo pip install flake8
30
32
pip install -r requirements.txt -r requirements/dev.txt
31
33
working-directory : xero-python
32
-
34
+
33
35
- name : Run Flake8
34
36
run : flake8 xero_python
35
37
working-directory : xero-python
36
-
38
+
37
39
- name : Build package
38
40
run : python setup.py sdist
39
41
working-directory : xero-python
43
45
# source venv/bin/activate
44
46
# pip install -r requirements/test.txt
45
47
# pytest -v
46
- # working-directory: xero-python
48
+ # working-directory: xero-python
49
+ deploy :
50
+ runs-on : ubuntu-latest
51
+ needs : build-test-lint
52
+ if : github.event_name == 'release' && github.event.action == 'published'
53
+
54
+ steps :
55
+ - name : Checkout xero-python repo
56
+ uses : actions/checkout@v4
57
+ with :
58
+ repository : XeroAPI/xero-python
59
+ path : xero-python
60
+
61
+ - name : Set up Python environment
62
+ uses : actions/setup-python@v5
63
+ with :
64
+ python-version : ' 3.8'
65
+ cache : ' pip'
66
+
67
+ - name : Install dependencies
68
+ run : |
69
+ python -m venv venv
70
+ source venv/bin/activate
71
+ pip install --upgrade pip
72
+ pip install black
73
+ sudo pip install flake8
74
+ pip install -r requirements.txt -r requirements/dev.txt
75
+ working-directory : xero-python
76
+
77
+ - name : Build new package version
78
+ run : python setup.py sdist
79
+ working-directory : xero-python
80
+
81
+ - name : Verify new package version
82
+ run : ls -al dist
83
+ working-directory : xero-python
84
+
85
+ - name : Deploy to test PyPi
86
+ env :
87
+ TWINE_USERNAME : ${{ secrets.TEST_PYPI_USERNAME }}
88
+ TWINE_PASSWORD : ${{ secrets.TEST_PYPI_PASSWORD }}
89
+ run : twine upload --repository-url https://test.pypi.org/legacy/ dist/*
90
+ working-directory : xero-python
0 commit comments