This repository has been archived by the owner on Dec 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
89 lines (71 loc) · 2.14 KB
/
publish.yaml
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
# This workflow builds and publishes package distribution to PyPI
name: Publish
# controls when the action will run
on:
push:
branches:
- 'master'
jobs:
publish_testpypi:
runs-on: ubuntu-latest
environment: testpypi
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.2.1
- name: Install dependencies
run: poetry install
- name: Lint
run: |
source $(poetry env info --path)/bin/activate # activate virtual environment
flake8 .
- name: Test
run: |
source $(poetry env info --path)/bin/activate # activate virtual environment
pytest tests
- name: Build
run: poetry build
- name: Publish testpypi
env:
POETRY_REPOSITORIES_TESTPYPI_URL: https://test.pypi.org/legacy/
POETRY_HTTP_BASIC_TESTPYPI_USERNAME: __token__
POETRY_HTTP_BASIC_TESTPYPI_PASSWORD: ${{secrets.TESTPYPI_API_TOKEN}}
run: poetry publish -r testpypi
publish_pypi:
runs-on: ubuntu-latest
environment: pypi
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.2.1
- name: Install dependencies
run: poetry install
- name: Lint
run: |
source $(poetry env info --path)/bin/activate # activate virtual environment
flake8 .
- name: Test
run: |
source $(poetry env info --path)/bin/activate # activate virtual environment
pytest tests
- name: Build
run: poetry build
- name: Publish pypi
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: __token__
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{secrets.PYPI_API_TOKEN}}
run: poetry publish