Create release on GitHub and PyPI #2
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
on: | |
push: | |
tags: | |
- 'v3.*' | |
name: Create release on GitHub and PyPI | |
permissions: | |
contents: write | |
jobs: | |
create_release: | |
name: Create release on GitHub | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Get tag | |
run: echo "GITHUB_TAG=${GITHUB_REF#*refs/tags/}" >> $GITHUB_ENV | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref_name }} | |
run: | | |
if [[ "${{ contains(env.GITHUB_TAG, 'a') || contains(env.GITHUB_TAG, 'b') || contains(env.GITHUB_TAG, 'c') }}" == "true" ]]; then | |
PRERELEASE_FLAG="--prerelease" | |
else | |
PRERELEASE_FLAG="" | |
fi | |
gh release create "$tag" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${tag#v}" \ | |
-F CHANGELOG.md \ | |
$PRERELEASE_FLAG | |
build_and_publish: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: pipx run poetry build | |
- run: pipx run poetry publish | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} |