-
Notifications
You must be signed in to change notification settings - Fork 5
74 lines (60 loc) · 1.87 KB
/
release.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
name: Publish packages
on:
release:
types: [released]
# Allow only one concurrent deployment
concurrency:
group: "release"
cancel-in-progress: false
jobs:
build-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: python3 -m pip install tox tox-conda
- uses: actions/cache@v3
with:
key: tox|build-package|${{ runner.os }}-${{ runner.arch}}|${{ hashFiles('requirements/locks/*') }}
path: .tox
- name: Build package
run: tox -e build-package
- uses: actions/upload-artifact@v3
with:
name: packages
path: dist/
retention-days: 10
if-no-files-found: error
pypi-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build-package
environment:
name: release
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: packages
path: dist/
# External actions are disabled via organization policies therefore we
# must instead manually implement it.
# https://docs.pypi.org/trusted-publishers/using-a-publisher/#the-manual-way
# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: python -m pip install twine
- name: Check package metadata
run: python -m twine check --strict dist/*
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: python3 -m twine upload --disable-progress-bar --verbose --non-interactive dist/*