Build package #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |