Prepare stubs for 2.5.1. #42
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
# This workflows will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI | |
on: | |
push: | |
tags: ["*"] | |
jobs: | |
build: | |
name: Build distribution 📦 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Replace string | |
uses: frabert/replace-string-action@v1.1 | |
id: version | |
with: | |
string: ${{ github.ref_name }} | |
pattern: "v?([0-9][.][0-9][.][0-9]).*" | |
replace-with: "$1" | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.12 | |
- uses: abatilo/actions-poetry@v2 | |
- name: Build | |
run: | | |
cd stubs/setup | |
mkdir mobase-stubs | |
cp -r ../${{ steps.version.outputs.replaced }}/mobase-stubs/* mobase-stubs/ | |
sed -i 's/__version__ = ".*"/__version__ = "${{ github.ref_name }}"/' mobase-stubs/__init__.pyi | |
TAG=${{ github.ref_name }} | |
poetry version ${TAG#v} | |
poetry build | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: stubs/setup/dist/ | |
publish-to-pypi: | |
name: Publish Python 🐍 distribution 📦 to PyPI | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |