Skip to content

PyPI release

PyPI release #33

Workflow file for this run

name: PyPI Release
on:
workflow_dispatch:
inputs:
version:
description: Version
required: false
default: patch
type: choice
options:
- patch
- minor
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install poetry
shell: bash
run: pip install poetry=="1.4.2"
- name: Build isolate
run: |
VERSION_TYPE="${{ github.event.inputs.version }}"
poetry version $VERSION_TYPE
# version has format '0.4.1'
current_version=$(poetry version -s)
echo "current_version=$current_version" >> $GITHUB_ENV
# tag has format 'v0.4.0' (note the 'v')
prev_version_tag=$(git describe --tags --abbrev=0)
echo "prev_version_tag=$prev_version_tag" >> $GITHUB_ENV
poetry build
- name: Generate a changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: cliff.toml
args: ${{ env.prev_version_tag }}..HEAD
env:
OUTPUT: CHANGES.md
- name: Set the release body
id: release
shell: bash
run: |
[[ -f ${{ steps.git-cliff.outputs.changelog }} ]] && r=$(< ${{ steps.git-cliff.outputs.changelog }}) || r=''
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "::set-output name=RELEASE_BODY::$r"
- name: Publish GitHub
uses: softprops/action-gh-release@v1
with:
name: isolate ${{ env.current_version }}
body: ${{ steps.release.outputs.RELEASE_BODY }}
tag_name: v${{ env.current_version }}
files: |
dist/isolate-${{env.current_version}}-py3-none-any.whl
dist/isolate-${{env.current_version}}.tar.gz
- name: Publish PyPI
env:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD -v -n
- name: Bump repo version
run: |
git clean -fxd # Clear all the changes
poetry version ${{env.current_version}}
poetry version prepatch
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
delete-branch: true
title: Bump the pyproject.toml version
base: main
token: ${{ secrets.RELEASER_GITHUB_PAT }}