296 add deployment workflow #4
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-and-upload | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
# temporary for testing | ||
pull_request: | ||
jobs: | ||
static-checks: | ||
uses: ./.github/workflows/statick-checks.yml | ||
Check failure on line 11 in .github/workflows/build-upload.yml GitHub Actions / .github/workflows/build-upload.ymlInvalid workflow file
|
||
integration-tests: | ||
uses: ./.github/workflows/integration-tests.yml | ||
build-upload: | ||
needs: [static-checks, integration-tests] | ||
name: Build and upload to PyPI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Install build dependencies | ||
run: pip install --no-cache-dir -U pip .['build'] | ||
- name: Compare tag and package version | ||
run: | | ||
TAG=${GITHUB_REF#refs/*/} | ||
VERSION=$(python -c 'import importlib.metadata; print(importlib.metadata.version("pymatic"))') | ||
if [ "$TAG" != "$VERSION" ]; then | ||
echo "Tag value and package version are different: ${TAG} != ${VERSION}" | ||
exit 1 | ||
fi | ||
- name: Build package | ||
run: rm -rf build/ dist/ && python -m build --sdist --wheel | ||
- name: Upload to PyPI | ||
run: twine upload dist/* | ||
env: | ||
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |