Skip to content

Commit

Permalink
fix: fix ga workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
en9inerd committed Sep 26, 2023
1 parent 4ee544d commit 6846456
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 10 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/publish_release.yml
Expand Up @@ -9,14 +9,48 @@ jobs:
release:
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
# This action uses Python Semantic Release v8
- name: Python Semantic Release
uses: relekang/python-semantic-release@master
id: release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Build a binary wheel and a source tarball
run: python3 -m build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true.
# See https://github.com/actions/runner/issues/1173
if: steps.release.outputs.released == 'true'

- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
7 changes: 6 additions & 1 deletion pyproject.toml
@@ -1,3 +1,8 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"

[tool.semantic_release]
version_variables = [
"tgeraser/__version__.py:VERSION",
]
3 changes: 0 additions & 3 deletions setup.cfg
Expand Up @@ -36,6 +36,3 @@ exclude = tests
[options.entry_points]
console_scripts =
tgeraser = tgeraser.core:entry

[semantic_release]
version_variable = tgeraser/__version__.py:VERSION
2 changes: 1 addition & 1 deletion tgeraser/__main__.py
Expand Up @@ -6,4 +6,4 @@
from . import core

if __name__ == "__main__":
asyncio.run(core.entry())
asyncio.run(core.main())
11 changes: 9 additions & 2 deletions tgeraser/core.py
Expand Up @@ -39,7 +39,7 @@
from .utils import cast_to_int, get_credentials


async def entry() -> None:
async def main() -> None:
"""
Entry function
"""
Expand Down Expand Up @@ -105,5 +105,12 @@ async def entry() -> None:
raise TgEraserException(err) from err


def entry() -> None:
"""
Entry point function
"""
asyncio.run(main())


if __name__ == "__main__":
asyncio.run(entry())
entry()

0 comments on commit 6846456

Please sign in to comment.