-
Notifications
You must be signed in to change notification settings - Fork 19
64 lines (61 loc) · 1.9 KB
/
build.yaml
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
name: build
run-name: Build package
on:
push:
branches: [main]
tags: [v1.*, v2.*]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
if: runner.os == 'Linux'
- name: Prepare environment
run: |
pip install -r ./requirements.txt
- name: Set version env
run: |
echo "LIBRARY_VERSION=$(python -c "import sys; sys.path.append('.'); from zabbix_utils.version import __version__; print(__version__)")" >> $GITHUB_ENV
- name: Build sdist
run: |
python setup.py sdist
- uses: actions/upload-artifact@v3
with:
name: Sources-${{ env.LIBRARY_VERSION }}
path: dist
build-wheel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Get pip cache
id: pip-cache
run: |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('dir=' + USER_CACHE_DIR)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip
- name: Install build requirements
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r ./requirements.txt
- name: Set version env
run: |
echo "LIBRARY_VERSION=$(python -c "import sys; sys.path.append('.'); from zabbix_utils.version import __version__; print(__version__)")" >> $GITHUB_ENV
- name: Build wheel
run: |
python setup.py bdist_wheel
- uses: actions/upload-artifact@v3
with:
name: Build-${{ env.LIBRARY_VERSION }}
path: dist