-
Notifications
You must be signed in to change notification settings - Fork 93
60 lines (49 loc) · 1.59 KB
/
publish.yml
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
name: Publish library
on:
push:
branches: [ main ]
jobs:
build-n-publish:
name: Build and publish to TestPyPI and PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2.2.2
with:
python-version: 3.9
- name: Install Poetry
uses: snok/install-poetry@v1.1.6
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --no-interaction
- name: Validate poetry configuration
run: poetry check
- name: Validate styling
run: poetry run pylint **/*.py
- name: Run tests
run: poetry run pytest
- name: Build source and wheels archives
run: poetry build
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Set version
run: |
echo "H1ST_VERSION=$(poetry version -s)" >> $GITHUB_ENV
- name: Create tag using environment variable for version
uses: julb/action-manage-tag@v1
with:
name: ${{ env.H1ST_VERSION }}
state: present
from: ${{ github.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}