-
Notifications
You must be signed in to change notification settings - Fork 64
74 lines (67 loc) · 2 KB
/
build.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# The "build" workflow produces wheels (and the sdist) for all python
# versions/platforms. Where possible (i.e. the build is not a cross-compile).
name: Build
on:
push:
branches:
# Run on release branches.
- "branch[0-9]*"
# Also run on certain other branches for testing.
- "build-workflow*"
tags:
- "v*"
env:
python-version: '3.8'
jobs:
build_sdist:
name: Build sdist
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: ${{ env.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Build a binary wheel and a source tarball
run: |
poetry build
- uses: actions/upload-artifact@v3
with:
path: ./dist/doccano*
upload_pypi_test:
name: Upload to PyPI (test)
needs: [build_sdist]
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref_name, 'build-workflow')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
upload_pypi:
name: Upload to PyPI (prod)
needs: [build_sdist]
runs-on: ubuntu-20.04
if: github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Publish a Python distribution to PyPI
uses: pypa/[email protected]
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
packages_dir: ./dist/