forked from kornia/kornia
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (60 loc) · 1.78 KB
/
pypi-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
name: PyPI Release
# https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [main]
release:
types: [published]
jobs:
build-sdist:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: python -m pip install --user --upgrade setuptools build
- name: Build source
run: |
python -m build --outdir dist/
ls -lh dist/
- uses: actions/upload-artifact@v2
with:
name: pypi-packages-${{ github.sha }}
path: dist
upload-packages:
runs-on: ubuntu-20.04
needs: build-sdist
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: pypi-packages-${{ github.sha }}
path: dist
- run: ls -lh dist/
- name: Upload to release
uses: AButler/[email protected]
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
with:
files: 'dist/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}
publish-pypi:
runs-on: ubuntu-20.04
needs: build-sdist
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/download-artifact@v2
with:
name: pypi-packages-${{ github.sha }}
path: dist
- run: ls -l dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}