-
Notifications
You must be signed in to change notification settings - Fork 3
85 lines (69 loc) · 1.87 KB
/
python-publish.yml
File metadata and controls
85 lines (69 loc) · 1.87 KB
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
name: Publish package to PyPI
on:
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
jobs:
test:
uses: ./.github/workflows/python-pytest.yml
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
- name: Build package
run: python setup.py sdist bdist_wheel
# upload artidact
- uses: actions/upload-artifact@v3
with:
name: orm-build
path: ./dist/
deploy:
# deploy only if tests passes
needs: [test, build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: orm-build
path: ./dist
- name: ls dist
run: ls ./dist -R
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
password: ${{ secrets.PYPI_API_TOKEN }}
upload-build-to-release:
# if triggered by release, then upload build files
if: github.event_name == 'release'
needs: build
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: orm-build
path: ./dist
- run: ls -R
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
uses: NBTX/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
targets: ./dist/*