Skip to content

Commit

Permalink
Merge a4737ad into 50dffcd
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCoderCarl authored Nov 22, 2022
2 parents 50dffcd + a4737ad commit d0c5a96
Show file tree
Hide file tree
Showing 11 changed files with 590 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Git
.git
.github
.gitignore
.gitattributes

# Docker
docker-compose.yml
docker-compose.yaml
**/Dockerfile
**/Containerfile*
.docker
.dockerignore

# Meta
README.md
LICENSE

# Configuration
changelog.json
*.db
38 changes: 38 additions & 0 deletions .github/workflows/code_quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Code Quality

on:
push:
branches: [ feature/* ]

jobs:
code_quality:
runs-on: ubuntu-latest
name: Checks with black and 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: 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 }}
38 changes: 38 additions & 0 deletions .github/workflows/ingore.yaml
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 }}
120 changes: 120 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Build

on:
pull_request:
branches: [ develop ]
paths-ignore:
- 'README.md'
- '.gitignore'
- '.dockerignore'
- 'changelog.json'

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 }}
build:
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 }}/epistolary:${{ needs.prepare.outputs.get_current_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 }}
telegram:
runs-on: ubuntu-latest
name: Notification
needs: [ prepare, build ]

steps:
- name: Notify telegram message after Packaging
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 }}/epistolary:${{ needs.prepare.outputs.get_current_tag }}</code>
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
167 changes: 167 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: Release

on:
pull_request:
branches: [ main ]
paths-ignore:
- 'README.md'
- '.gitignore'
- '.dockerignore'
- 'changelog.json'

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: 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 }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: prepare
outputs:
get_release_url: ${{ steps.set_release_url.outputs.release_url }}
steps:

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
with:
configuration: "changelog.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.REPOS_TOKEN }}
with:
tag_name: ${{ needs.prepare.outputs.get_current_tag }}
release_name: Release ${{ needs.prepare.outputs.get_current_tag }}
body: ${{ steps.github_release.outputs.changelog }}

- name: Set Release URL
id: set_release_url
run: echo "::set-output name=release_url::${{ steps.create_release.outputs.upload_url }}"

- 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 }}
build:
name: Publish on DockerHub
needs: [ prepare, release ]
runs-on: ubuntu-latest

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 }}/epistolary: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: [ prepare, release, build ]

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 }}/epistolary:latest</code>
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
<b>Release URL:</b> https://github.com/${{ github.repository }}/releases/tag/${{ needs.prepare.outputs.get_current_tag }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Secret file
settings.toml
Loading

0 comments on commit d0c5a96

Please sign in to comment.