Create Release & Upload To PyPI #38
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: Create Release & Upload To PyPI | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- v?[0-9]+.[0-9]+.[0-9]+ # add .* to allow dev releases | |
jobs: | |
build: | |
name: requirementslib PyPI Upload | |
runs-on: ubuntu-latest | |
env: | |
CI: "1" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1.0.0 | |
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.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install nox | |
run: | | |
python -m pip install --upgrade .[dev] | |
- name: Build wheels | |
run: | | |
nox -s package | |
# 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@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
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 | |
nox -s bump_version | |
git commit -am 'pre-bump' | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |