Skip to content

Commit

Permalink
Try to switch to PyPi trusted publisher.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Sep 20, 2023
1 parent a1f5ef3 commit c6d8baa
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 106 deletions.
49 changes: 33 additions & 16 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# 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: Upload Python Package
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on:
push:
tags: ["*"]

jobs:
deploy:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Replace string
Expand All @@ -20,21 +20,38 @@ jobs:
string: ${{ github.ref_name }}
pattern: "v?([0-9][.][0-9][.][0-9]).*"
replace-with: "$1"
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
python-version: 3.11
- 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
python setup.py sdist bdist_wheel
twine upload dist/*
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: 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
21 changes: 0 additions & 21 deletions stubs/setup/LICENSE

This file was deleted.

Empty file removed stubs/setup/mobase-stubs/.keep
Empty file.
7 changes: 7 additions & 0 deletions stubs/setup/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions stubs/setup/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tool.poetry]
name = "mobase-stubs"
version = "v2.5.0.dev12"
description = "PEP561 stub files for the mobase Python API."
authors = ["Holt59 <capelle.mikael@gmail.com>"]
license = "MIT"
readme = "README.md"
packages = [{ include = "mobase-stubs" }]
homepage = "https://www.modorganizer.org/python-plugins-doc/"
documentation = "https://www.modorganizer.org/python-plugins-doc/"
repository = "https://github.com/ModOrganizer2/mo2-pystubs-generation"

[tool.poetry.dependencies]
python = "^3.11"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
69 changes: 0 additions & 69 deletions stubs/setup/setup.py

This file was deleted.

0 comments on commit c6d8baa

Please sign in to comment.