add ngrok and auth telegram 🚀 #9
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
name: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
jobs: | |
train: | |
name: RUN Train and Push To Docker | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build Docker Image and Run Tests and Train | |
run: | | |
docker build . --file Dockerfile --tag ammarmoulla/machine_translate:v1 | |
docker run ammarmoulla/machine_translate:v1 | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker push ammarmoulla/machine_translate:v1 | |
curl -X POST "https://api.telegram.org/bot${{ secrets.AUTH_Telegram }}/sendMessage" \ | |
-d "chat_id=${{secrets.CHAT_ID}}" \ | |
-d "text=Train is Done!! and Push New image to DockerHub" | |
deploy: | |
name: RUN Web Serivce | |
runs-on: ubuntu-latest | |
needs: [train] | |
steps: | |
- name: Pull and UP Fastapi | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker pull ammarmoulla/machine_translate:v1 | |
docker run --entrypoint "sh" ammarmoulla/machine_translate:v1 ./fastapi/start.sh | |
curl -X POST "https://api.telegram.org/bot${{ secrets.AUTH_Telegram }}/sendMessage" \ | |
-d "chat_id=${{secrets.CHAT_ID}}" \ | |
-d "text=Deploy is Done!!" |