Skip to content

Commit

Permalink
Merge pull request #18 from tm-a-t/installation
Browse files Browse the repository at this point in the history
Setup wizard, packaging, poetry, semantic releases
  • Loading branch information
vanutp committed Dec 25, 2021
2 parents b7db892 + 2f34246 commit fe52467
Show file tree
Hide file tree
Showing 25 changed files with 1,296 additions and 69 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Lint & release project
on: [ push, pull_request ]

jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install poetry
shell: bash
run: |
pip install poetry
poetry config virtualenvs.in-project true
- name: Load dependency cache
id: load-cache
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install
if: steps.load-cache.outputs.cache-hit != 'true'

Release:
concurrency: release
needs: Lint
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install poetry
shell: bash
run: |
pip install poetry
poetry config virtualenvs.in-project true
- name: Load dependency cache
id: load-cache
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
source .venv/bin/activate
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
export GH_TOKEN="${GITHUB_TOKEN}"
export REPOSITORY_USERNAME="__token__"
export REPOSITORY_PASSWORD="${PYPI_TOKEN}"
python -m semantic_release publish
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ venv/

**/__pycache__/

dist/
*.egg-info

*.session
*.session-journal

data/

config.py
config.yaml
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![TGPy](readme_assets/TGPy.png)
![TGPy](https://raw.githubusercontent.com/tm-a-t/TGPy/master/readme_assets/TGPy.png)

## Run Python code right in your Telegram messages

Expand All @@ -8,7 +8,7 @@ Made with Telethon library, TGPy is a tool for evaluating expressions and Telegr
- Interact with your messages and chats
- Automate sending messages and more

![Example](readme_assets/example.gif)
![Example](https://raw.githubusercontent.com/tm-a-t/TGPy/master/readme_assets/example.gif)

Just send Python code to any chat, and it will be executed. Change your message to change the result.

Expand Down Expand Up @@ -92,7 +92,7 @@ async def delete():
4. Install the requirements and run TGPy:
```shell
> pip install -r requirements.txt
> python -m app
> python -m tgpy
```

5. For the first time, you'll need to log in with a confirmation code from Telegram.
Expand Down
21 changes: 0 additions & 21 deletions app/__init__.py

This file was deleted.

5 changes: 0 additions & 5 deletions app/__main__.py

This file was deleted.

2 changes: 1 addition & 1 deletion guide/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ phone = ...
4. Install the requirements and run TGPy:
```shell
$ pip install -r requirements.txt
$ python -m app
$ python -m tgpy
```

5. For the first time, you'll have to log in with a confirmation code from Telegram.
Expand Down
Loading

0 comments on commit fe52467

Please sign in to comment.