Skip to content

Commit 2616d89

Browse files
committed
We will use github actions for release
1 parent a8bf236 commit 2616d89

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

.github/workflows/python-package.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python package
4+
name: CI/CD
55

66
on:
77
push:
88
pull_request:
99
branches: [ dev ]
1010

1111
jobs:
12-
build:
12+
ci:
1313
env:
1414
# Fake a TRAVIS env so that the pre-existing test cases would behave like before
1515
TRAVIS: true
@@ -19,6 +19,7 @@ jobs:
1919
LAB_OBO_CONFIDENTIAL_CLIENT_ID: ${{ secrets.LAB_OBO_CONFIDENTIAL_CLIENT_ID }}
2020
LAB_OBO_PUBLIC_CLIENT_ID: ${{ secrets.LAB_OBO_PUBLIC_CLIENT_ID }}
2121

22+
# Derived from https://docs.github.com/en/actions/guides/building-and-testing-python#starting-with-the-python-workflow-template
2223
runs-on: ubuntu-latest
2324
strategy:
2425
matrix:
@@ -58,3 +59,31 @@ jobs:
5859
- name: Test with pytest
5960
run: |
6061
pytest
62+
63+
cd:
64+
needs: ci
65+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/main')
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: actions/checkout@v2
69+
- name: Set up Python 3.9
70+
uses: actions/setup-python@v2
71+
with:
72+
python-version: 3.9
73+
- name: Build a package for release
74+
run: |
75+
python -m pip install build --user
76+
python -m build --sdist --wheel --outdir dist/ .
77+
- name: Publish to TestPyPI
78+
uses: pypa/[email protected]
79+
if: github.ref == 'refs/heads/main'
80+
with:
81+
user: __token__
82+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
83+
repository_url: https://test.pypi.org/legacy/
84+
- name: Publish to PyPI
85+
if: startsWith(github.ref, 'refs/tags')
86+
uses: pypa/[email protected]
87+
with:
88+
user: __token__
89+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)