-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (71 loc) · 2.44 KB
/
pypi-upload.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: PyPI Upload
on:
release:
types: [ created ]
jobs:
machine_stats:
name: Machine Stats PyPI Upload
runs-on: ubuntu-latest
defaults:
run:
working-directory: unix
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: 3.8
architecture: x64
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=${GITHUB_REF/refs\/tags\//}
PLACEHOLDER='version="develop"'
VERSION_FILE='setup.py'
# grep ensures the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"
- name: Install pypa/build and twine
run: |
python -m pip install build twine
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Upload to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --verbose -u '__token__' dist/*
virt_stats:
name: Virt Stats PyPI Upload
runs-on: ubuntu-latest
defaults:
run:
working-directory: libvirt
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: 3.8
architecture: x64
- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=${GITHUB_REF/refs\/tags\//}
PLACEHOLDER='version="develop"'
VERSION_FILE='setup.py'
# grep ensures the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"
- name: Install pypa/build and twine
run: |
python -m pip install build twine
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/ .
- name: Upload to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --verbose -u '__token__' dist/*