Skip to content

Commit

Permalink
Merge pull request #1682 from cookiecutter/issue-1681-use-pypi-publis…
Browse files Browse the repository at this point in the history
…h-action

Follow PyPA guide to release package using GitHub Actions.
  • Loading branch information
ericof committed May 30, 2022
2 parents 5918a8b + 2a819d7 commit f729dde
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/pip-publish.yml
Expand Up @@ -7,20 +7,38 @@ on:
jobs:
upload:
runs-on: ubuntu-latest

environment:
name: pypi.org
url: https://pypi.org/project/cookiecutter/

steps:

- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.7"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
- name: Package project
run: python setup.py sdist bdist_wheel
- name: Upload distributions
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*
python-version: 3.9

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit f729dde

Please sign in to comment.