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
|
name: Deploy
on:
push:
branches:
- master
- "*deploy*"
release:
types:
- published
jobs:
build:
if: github.repository == 'pytest-dev/iniconfig'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: deploy-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
deploy-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install build + twine
run: python -m pip install build twine setuptools_scm
- name: git describe output
run: git describe --tags
- id: scm_version
run: |
VERSION=$(python -m setuptools_scm --strip-dev)
echo SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION >> $GITHUB_ENV
- name: Build package
run: python -m build
- name: twine check
run: twine check dist/*
- name: Publish package to PyPI
if: github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
|