Skip to content

build: mirrored publish to d.py-interactions and interactions.py #1336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
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
41 changes: 27 additions & 14 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
name: Publish release
name: Publish to PyPI under the mirrored and original name

on:
release:
types:
- published

env:
PACKAGE_NAME1: discord-py-interactions
PACKAGE_NAME2: interactions.py

jobs:
deploy:
name: Deploy
build-and-publish:
runs-on: ubuntu-latest
if: "!github.event.release.prerelease"
steps:
- uses: actions/checkout@v2
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
pip install build twine

- name: Build and publish packages
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
on:
release:
types: [released]
for PACKAGE_NAME in $PACKAGE_NAME1 $PACKAGE_NAME2; do
sed -i "s/name=.*,/name=\"$PACKAGE_NAME\",/" setup.py
python -m build --outdir dist/$PACKAGE_NAME
python -m twine upload --skip-existing -u __token__ -p $PYPI_API_TOKEN dist/$PACKAGE_NAME/*
done
15 changes: 10 additions & 5 deletions interactions/client/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import os
import sys
from collections import defaultdict
from importlib.metadata import version as _v
from importlib.metadata import version as _v, PackageNotFoundError
from typing import TypeVar, Union, Callable, Coroutine

__all__ = (
Expand Down Expand Up @@ -82,10 +82,15 @@

_ver_info = sys.version_info

try:
__version__ = _v("interactions")
except Exception:
__version__ = "0.0.0"
repo_names = ("interactions.py", "discord-py-interactions")
for repo_name in repo_names:
try:
__version__ = _v(repo_name)
break
except PackageNotFoundError:
__version__ = "0.0.0"


__repo_url__ = "https://github.com/interactions-py/interactions.py"
__py_version__ = f"{_ver_info[0]}.{_ver_info[1]}"
__api_version__ = 10
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "discord-py-interactions"
name = "interactions.py"
version = "5.0.0"
description = "Easy, simple, scalable and modular: a Python API wrapper for interactions."
authors = [
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
extras_require["dev"] = extras_require["tests"] + extras_require["docs"] + ["pre-commit"]

setup(
name="discord-py-interactions",
name="interactions.py",
description=pyproject["tool"]["poetry"]["description"],
long_description=(Path(__file__).parent / "README.md").read_text(),
long_description_content_type="text/markdown",
Expand Down