-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
695 additions
and
0 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,37 @@ | ||
name: Code Quality | ||
|
||
on: | ||
push: | ||
branches: [ feature/* ] | ||
|
||
jobs: | ||
code_quality: | ||
runs-on: ubuntu-latest | ||
name: Checks with black, isort | ||
container: python:3.9 | ||
|
||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run script | ||
run: pip install -r requirements.txt | ||
|
||
- name: Black check | ||
run: black --check . | ||
|
||
- name: Isort check | ||
run: isort --check . | ||
|
||
- name: Step To run on failure | ||
if: ${{ failure() }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
<b>!!! FAILED !!!</b> | ||
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} |
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,38 @@ | ||
name: Ignore and notify | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
paths-ignore: | ||
- 'README.md' | ||
- '.gitignore' | ||
- '.dockerignore' | ||
- 'changelog.json' | ||
|
||
jobs: | ||
|
||
telegram: | ||
runs-on: ubuntu-latest | ||
name: Notify after update | ||
steps: | ||
|
||
- name: Notify after released image | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
${{ github.actor }} created commit: | ||
<b>WorkFlows:</b> <a href="https://github.com/${{ github.repository }}/actions/">ActionsList</a> | ||
Repository: ${{ github.repository }} | ||
Branch: ${{ github.ref }} | ||
<b>Something were changed</b> | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} |
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,112 @@ | ||
name: Publish | ||
|
||
on: | ||
pull_request: | ||
branches: [ develop ] | ||
|
||
jobs: | ||
|
||
prepare: | ||
name: Prepare env & label | ||
runs-on: ubuntu-latest | ||
outputs: | ||
get_current_tag: ${{ steps.set_current_tag_id.outputs.current_tag }} | ||
|
||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/github-tag-action@v6.0 | ||
with: | ||
github_token: ${{ secrets.REPOS_TOKEN }} | ||
|
||
- name: Set label develop | ||
uses: actions-ecosystem/action-add-labels@v1 | ||
with: | ||
labels: develop | ||
|
||
- name: Add author as assignees | ||
uses: actions-ecosystem/action-add-assignees@v1 | ||
with: | ||
assignees: ${{ github.actor }} | ||
github_token: ${{ secrets.REPOS_TOKEN }} | ||
|
||
- name: Set tag version to output | ||
id: set_current_tag_id | ||
run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}" | ||
|
||
- name: Notify if failure | ||
if: ${{ failure() }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
<b>!!! FAILED !!!</b> | ||
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} | ||
docker: | ||
runs-on: ubuntu-latest | ||
needs: prepare | ||
name: Publish on DockerHub | ||
|
||
steps: | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and push | ||
id: push_image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: Containerfile | ||
tags: ${{ secrets.DOCKER_USERNAME }}/techpriest_bot:${{ needs.prepare.outputs.get_current_tag }} | ||
|
||
- name: Step To run on failure | ||
if: ${{ failure() }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
<b>!!! FAILED !!!</b> | ||
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} | ||
- name: Notify in telegram after image was pushed | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
${{ github.actor }} created commit: | ||
<b>WorkFlows:</b> <a href="https://github.com/${{ github.repository }}/actions">ActionsList</a> | ||
Commit with tag: ${{ needs.prepare.outputs.get_current_tag }} | ||
Repository: ${{ github.repository }} | ||
Branch: ${{ github.ref }} | ||
<b>Pushed image:</b> <code>docker pull ${{ secrets.DOCKER_USERNAME }}/techpriest_bot:${{ needs.prepare.outputs.get_current_tag }}</code> | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} |
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,121 @@ | ||
name: Release | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
prepare: | ||
name: Prepare env & label | ||
runs-on: ubuntu-latest | ||
outputs: | ||
get_current_tag: ${{ steps.set_current_tag_id.outputs.current_tag }} | ||
|
||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/github-tag-action@v6.0 | ||
with: | ||
github_token: ${{ secrets.REPOS_TOKEN }} | ||
|
||
- name: Set label release | ||
uses: actions-ecosystem/action-add-labels@v1 | ||
with: | ||
labels: release | ||
|
||
- name: Add author as assignees | ||
uses: actions-ecosystem/action-add-assignees@v1 | ||
with: | ||
assignees: ${{ github.actor }} | ||
github_token: ${{ secrets.REPOS_TOKEN }} | ||
|
||
- name: Create a GitHub release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.tag_version.outputs.new_tag }} | ||
name: Release ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
|
||
- name: Set tag version to output | ||
id: set_current_tag_id | ||
run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}" | ||
|
||
- name: Notify if failure | ||
if: ${{ failure() }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
<b>!!! FAILED !!!</b> | ||
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} | ||
docker: | ||
runs-on: ubuntu-latest | ||
needs: prepare | ||
name: Publish on DockerHub | ||
|
||
steps: | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: Containerfile | ||
tags: ${{ secrets.DOCKER_USERNAME }}/techpriest_bot:latest | ||
|
||
- name: Notify if failure | ||
if: ${{ failure() }} | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
<b>!!! FAILED !!!</b> | ||
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} | ||
telegram: | ||
runs-on: ubuntu-latest | ||
name: Notification | ||
needs: [docker, prepare] | ||
|
||
steps: | ||
- name: Notify telegram message after Released | ||
uses: appleboy/telegram-action@master | ||
with: | ||
to: ${{ secrets.TELEGRAM_CHAT }} | ||
token: ${{ secrets.TELEGRAM_TOKEN }} | ||
format: html | ||
message: | | ||
${{ github.actor }} created commit: | ||
<b>WorkFlows:</b> <a href="https://github.com/${{ github.repository }}/actions">ActionsList</a> | ||
Commit with tag: ${{ needs.prepare.outputs.get_current_tag }} | ||
Repository: ${{ github.repository }} | ||
Branch: ${{ github.ref }} | ||
<b>Pushed image:</b> <code>docker pull ${{ secrets.DOCKER_USERNAME }}/techpriest_bot:latest</code> | ||
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }} |
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
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,14 @@ | ||
FROM python:3.9-alpine as builder | ||
|
||
WORKDIR /opt | ||
|
||
COPY ["bot.py", "/opt/"] | ||
COPY ["mongodb.py", "/opt/"] | ||
COPY ["dynaconfig.py", "/opt/"] | ||
COPY requirements.txt requirements.txt | ||
|
||
RUN pip3 install --no-cache-dir -r requirements.txt | ||
|
||
FROM builder | ||
|
||
CMD ["python3", "/opt/bot.py"] |
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,13 @@ | ||
drestart: dstop dstart | ||
|
||
dstart: | ||
echo "Starting docker-compose deattahced" | ||
docker-compose up -d | ||
|
||
dstop: | ||
echo "Stopping docker-compose" | ||
docker-compose down | ||
|
||
dclear: | ||
echo "Prune docker system" | ||
docker system prune -f |
Oops, something went wrong.