Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Publish release

on:
release:
types: [created]

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
actions: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: '3.7'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y

- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install Poetry Plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: Check Pre-Release Version
id: check-version
run: |
echo "::debug::Package version: $(poetry version --short)"
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || echo prerelease=true >> $GITHUB_OUTPUT

- name: Exit if Pre-Release Version
if: steps.check-version.outputs.prerelease == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}

- name: Build package
run: poetry build

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1