Skip to content

Commit

Permalink
Merge pull request #51 from pytest-dev/add-deploy
Browse files Browse the repository at this point in the history
rework deploy pipeline for hatch usage and modern checkout
  • Loading branch information
RonnyPfannschmidt committed Jan 7, 2023
2 parents 5f617e3 + 9426557 commit 93f5930
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ on:
push:
branches:
- master
- "*deploy*"
release:
types:
- published

jobs:
build:
if: github.repository == 'pytest-dev/iniconfig'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- run: |
git fetch --prune --unshallow
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: deploy-${{ hashFiles('**/setup.py') }}
key: deploy-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
deploy-
Expand All @@ -31,17 +31,22 @@ jobs:
with:
python-version: "3.x"

- name: Install dependencies
- 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: |
python -m pip install -U pip
python -m pip install -U setuptools setuptools_scm twine wheel
VERSION=$(python -m setuptools_scm --strip-dev)
echo SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION >> $GITHUB_ENV
- name: Build package
run: |
git tag
python setup.py --version
python setup.py sdist --format=gztar bdist_wheel
twine check dist/*
run: python -m build

- name: twine check
run: twine check dist/*

- name: Publish package to PyPI
if: github.event.action == 'published'
Expand All @@ -51,7 +56,7 @@ jobs:
password: ${{ secrets.pypi_password }}

- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
Expand Down

0 comments on commit 93f5930

Please sign in to comment.