fix : Throwing invalid data error for server errors #10
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: KTU Bot CI/CD | |
on: | |
push: | |
branches: | |
- prod | |
jobs: | |
build-and-push: | |
name: Build and push docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Login to docker hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/ktu-bot:latest | |
deploy: | |
name: Deploy docker container to VPS | |
runs-on: ubuntu-latest | |
needs: build-and-push | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Deploy to VPS | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script: | | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/ktu-bot:latest | |
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/ktu-bot:latest ktu-bot:latest | |
docker stop ktu-bot || true | |
docker rm ktu-bot || true | |
docker run -d --restart always -e BOT_TOKEN=${{ secrets.BOT_TOKEN }} -e FIREBASE_SERVICE_ACCOUNT="${{ secrets.FIREBASE_SERVICE_ACCOUNT }}" --name ktu-bot ktu-bot |