mirror of
https://github.com/ModOrganizer2/pystubs-generation.git
synced 2026-07-27 14:07:13 -07:00
58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
# 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@v7
|
|
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@v7
|
|
with:
|
|
name: python-package-distributions
|
|
path: dist/
|
|
- name: Publish distribution 📦 to PyPI
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|