-
Notifications
You must be signed in to change notification settings - Fork 4
93 lines (77 loc) · 2.56 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Build
# Controls when the action will run.
on:
workflow_call:
jobs:
build:
# convert this to a matrix if builds differ between platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest']
steps:
- name: Checking out the repo
uses: actions/checkout@v3
# see *py_ver* in ci/update.py
- name: Setting up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: pip
cache-dependency-path: |
ci/requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --progress-bar=off -r ci/requirements.txt
- name: Get latest tags
run: |
git pull --tags
echo "git_tag_head='$(git tag --points-at HEAD)'" >> $GITHUB_ENV
echo "git_tag_head='$(git tag --points-at HEAD)'"
- name: Set version number
# modify source files to reflect the current version
# (relevant for pre-releases indicated by tag only)
# Does not modify the git history
if: ${{ env.git_tag_head }} # there is a tag at the latest commit
shell: python
run: |
from semantic_release.history import set_new_version, get_current_version
cv = get_current_version()
print(f"Setting current version '{cv}':", set_new_version(cv))
- name: Build
run: tox -e build -v
- name: Upload package artifact for publishing job
uses: actions/upload-artifact@v3
with:
name: packages
path: dist/*.whl
- name: Upload source artifact for publishing job
# upload source package only once
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-artifact@v3
with:
name: packages
path: dist/*.tar.gz
publish:
needs: [build]
runs-on: 'ubuntu-latest'
steps:
- name: Checking out the repo
uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --progress-bar=off -r ci/requirements.txt
- name: Download package artifacts
uses: actions/download-artifact@v3
with:
name: packages
path: dist
- name: Check generated packages
run: twine check dist/*.*
- name: Upload packages
env:
TWINE_PASSWORD: "${{ secrets.PYPI_TOKEN }}"
run: |
twine upload -u __token__ -r pypi dist/*.*