Skip to content

Commit

Permalink
Add PyPi release github workflow.
Browse files Browse the repository at this point in the history
Signed-off-by: Aliwoto <aminnimaj@gmail.com>
  • Loading branch information
ALiwoto committed Dec 24, 2024
1 parent ab2ea94 commit 500081e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 5 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
on:
push:
branches: [ Production ]

permissions: write-all

jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build source and wheel distributions
run: |
python -m pip install --upgrade build twine
python -m build
make venv
make api
twine check --strict dist/Kurigram*
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Set the Version
run: |
grep_result=$(grep version pyrogram/__init__.py)
prefix="__version__ = \""
suffix="\""
final_value=${grep_result#"$prefix"}
final_value=${final_value%"$suffix"}
echo "CURRENT_LIB_VERSION=$(echo 'v'$final_value)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: elgohr/Github-Release-Action@v5
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag: ${{ env.CURRENT_LIB_VERSION }}
title: ${{ env.CURRENT_LIB_VERSION }}
# draft: false
prerelease: false

- name: Get Asset name
run: |
export PKG=$(ls dist/ | grep tar)
set -- $PKG
echo "name=$1" >> $GITHUB_ENV
- name: Upload Release Asset (sdist) to GitHub
id: upload-release-asset
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
tag_name: ${{ env.CURRENT_LIB_VERSION }}
files: dist/${{ env.name }}
# asset_name: ${{ env.name }}
# asset_content_type: application/zip
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
errors_compiler.start()

setup(
name="Pyrogram",
name="Kurigram",
version=version,
description="Elegant, modern and asynchronous Telegram MTProto API framework in Python for users and bots",
long_description=readme,
long_description_content_type="text/markdown",
url="https://github.com/pyrogram",
download_url="https://github.com/pyrogram/pyrogram/releases/latest",
url="https://github.com/KurimuzonAkuma/pyrogram",
download_url="https://github.com/KurimuzonAkuma/pyrogram/releases/latest",
author="Dan",
author_email="dan@pyrogram.org",
license="LGPLv3",
Expand Down Expand Up @@ -74,9 +74,9 @@
],
keywords="telegram chat messenger mtproto api client library python",
project_urls={
"Tracker": "https://github.com/pyrogram/pyrogram/issues",
"Tracker": "https://github.com/KurimuzonAkuma/pyrogram/issues",
"Community": "https://t.me/pyrogram",
"Source": "https://github.com/pyrogram/pyrogram",
"Source": "https://github.com/KurimuzonAkuma/pyrogram",
"Documentation": "https://docs.pyrogram.org",
},
python_requires="~=3.8",
Expand Down

0 comments on commit 500081e

Please sign in to comment.