Files
pipenv/.github/workflows/pypi_upload.yml
T
2020-04-28 22:07:08 -04:00

70 lines
2.0 KiB
YAML

name: Upload Python Package
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- v[0-9]+.[0-9]+.* # add .* to allow dev releases
jobs:
deploy:
name: pipenv PyPI Upload
runs-on: ubuntu-latest
env:
CI: "1"
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: webfactory/ssh-agent@v0.1.1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade --upgrade-strategy=eager pip setuptools wheel twine
python -m pip install .
python -m pipenv install --dev
env:
PIPENV_DEFAULT_PYTHON_VERSION: "3.7"
- name: Build wheels
run: |
python -m pipenv run python setup.py sdist bdist_wheel
# to upload to test pypi, pass repository_url: https://test.pypi.org/legacy/ and use secrets.TEST_PYPI_TOKEN
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
packages_dir: dist/
# git push https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git HEAD:master
# we need to use a deploy key for this to get around branch protection as the default token fails
- name: Pre-bump
run: |
git config --local user.name 'Github Action'
git config --local user.email action@github.com
python -m pipenv run inv release.bump-version --dev --commit
git push git@github.com:${{ github.repository }}.git HEAD:master