Skip to content

Commit 90a1e78

Browse files
authored
Update main.yml
1 parent 64d01f8 commit 90a1e78

File tree

1 file changed

+48
-12
lines changed

1 file changed

+48
-12
lines changed

.github/workflows/main.yml

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,62 @@
1-
name: Python package
1+
name: CI for Cool-Graph
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
release:
11+
types: [published]
412

513
jobs:
614
build:
715
runs-on: ubuntu-latest
16+
817
steps:
9-
- uses: actions/checkout@v2
10-
- name: Set up Python
18+
- name: Check out code
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Python 3.8
1122
uses: actions/setup-python@v2
1223
with:
1324
python-version: 3.8
25+
1426
- name: Install dependencies
1527
run: |
1628
python -m pip install --upgrade pip
17-
pip install build
18-
- name: Build a source tarball
19-
if: startsWith(github.ref, 'refs/tags')
29+
pip install -r requirements.txt
30+
31+
- name: Run tests
2032
run: |
21-
pipenv run python setup.py sdist
22-
- name: Publish distribution 📦 to PyPI
23-
if: startsWith(github.ref, 'refs/tags')
24-
uses: pypa/gh-action-pypi-publish@release/v1
33+
pytest
34+
35+
release:
36+
runs-on: ubuntu-latest
37+
needs: build
38+
39+
steps:
40+
- name: Check out code
41+
uses: actions/checkout@v2
42+
43+
- name: Set up Python 3.8
44+
uses: actions/setup-python@v2
2545
with:
26-
password: ${{ secrets.PYPI_API_TOKEN }}
46+
python-version: 3.8
47+
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install setuptools wheel twine
52+
53+
- name: Build package
54+
run: |
55+
python setup.py sdist bdist_wheel
56+
57+
- name: Publish to PyPI
58+
env:
59+
TWINE_USERNAME: __token__
60+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
61+
run: |
62+
python -m twine upload dist/*

0 commit comments

Comments
 (0)