forked from pyrogram/pyrogram
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Aliwoto <aminnimaj@gmail.com>
- Loading branch information
Showing
2 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
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
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 |
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