Skip to content

Commit 553c0ab

Browse files
author
Vignesh Kennadi
committed
Adds Deploy step
1 parent 64e438b commit 553c0ab

File tree

1 file changed

+48
-4
lines changed

1 file changed

+48
-4
lines changed

.github/workflows/build-test-lint.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Python Build, Lint
22

33
on:
44
push:
5+
release:
6+
types: [published]
57

68
jobs:
79
build-test-lint:
@@ -16,7 +18,7 @@ jobs:
1618

1719
- name: Set up Python environment
1820
uses: actions/setup-python@v5
19-
with:
21+
with:
2022
python-version: '3.8'
2123
cache: 'pip'
2224

@@ -29,11 +31,11 @@ jobs:
2931
sudo pip install flake8
3032
pip install -r requirements.txt -r requirements/dev.txt
3133
working-directory: xero-python
32-
34+
3335
- name: Run Flake8
3436
run: flake8 xero_python
3537
working-directory: xero-python
36-
38+
3739
- name: Build package
3840
run: python setup.py sdist
3941
working-directory: xero-python
@@ -43,4 +45,46 @@ jobs:
4345
# source venv/bin/activate
4446
# pip install -r requirements/test.txt
4547
# 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

Comments
 (0)