.github/workflows/release.yml
# Publish package on release branch if it's tagged with 'v*'
name: release & publish workflow
# Controls when the action will run.
on:
workflow_dispatch:
inputs:
version:
description: Release Version
required: true
default: N.N.N.devN
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
release:
name: Create Release
runs-on: ubuntu-latest
strategy:
matrix:
python-versions: ['3.11']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Push tag
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag "v${{ github.event.inputs.version }}" --force
git push origin "v${{ github.event.inputs.version }}" --force
- name: Build wheels and source tarball
run: >-
poetry build
- name: show temporary files
run: >-
ls -l
- name: Create github release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
files: dist/*.whl
draft: false
prerelease: contains(github.event.inputs.version, 'dev')
generate_release_notes: true
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN}}
skip_existing: true