Skip to content

version 1.3.7-b1

version 1.3.7-b1 #2

Workflow file for this run

name: Publish Python 🐍 package 📦 to PyPI
on:
push:
branches:
- master
workflow_dispatch:
jobs:
get-package-version:
name: Get ${{ github.ref_name }} package version
runs-on: ubuntu-latest
outputs:
package-version: ${{ steps.package-version.outputs.package-version }}
version-compairson: ${{ steps.semver.outputs.comparison-result}}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Get package version
id: package-version
run: echo "package-version=v$(poetry version --short)" >> $GITHUB_OUTPUT
- name: Get release version
id: release-version
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
- name: Analyze semver
id: semver
uses: madhead/semver-utils@latest
with:
lenient: false
version: ${{ steps.package-version.outputs.package-version }}
compare-to: ${{ steps.release-version.outputs.release }}
- name: Check pre-release
if: ${{ steps.semver.outputs.prerelease != '' }}
run: |
echo "Checking if version is a pre-release"
echo "::error::Skipping pre-release version: ${{ steps.package-version.outputs.package-version}}"
exit 1
deploy:
name: Deploy Python 🐍 distributions 📦 to PyPI
needs: [get-package-version]
runs-on: ubuntu-latest
if: ${{ needs.get-package-version.outputs.version-compairson != '=' }}
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3
- name: Build and publish to PyPI
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
- name: Create release ${{ needs.get-package-version.outputs.package-version }}
uses: ncipollo/release-action@v1
with:
commit: ${{ github.ref_name }}
tag: ${{ needs.get-package-version.outputs.package-version }}
generateReleaseNotes: true
artifacts: |
dist/*.whl
dist/*.tar.gz