Skip to content

refactor: tradehistory error fix #193

refactor: tradehistory error fix

refactor: tradehistory error fix #193

Workflow file for this run

name: Build and Deploy
on:
push:
branches:
- main
- dev
- dev-be
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Docker Hub login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push Docker images
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server -f ./dockerfile-server .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
docker build --build-arg VITE_API_BASE_URL=${{ secrets.VITE_API_BASE_URL }} -t ${{ secrets.DOCKERHUB_USERNAME }}/corinee-client -f ./dockerfile-client .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/corinee-client
- name: make deploy environment
run: |
echo "${{secrets.DEPLOY_ENV}}" > .env
- name: Send files & deploy script
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
source: ${{ secrets.DEPLOY_FILES }}
target: /corinee
overwrite: true
- name: Docker Container run
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-server
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/corinee-client
cd /corinee
docker-compose down
docker-compose up -d
rm -rf .env docker-compose.yml
- name: Generate Error Report
if: failure()
run: |
echo "Deployment Report" > report.txt
echo "===================" >> report.txt
echo "Commit SHA: ${{ github.sha }}" >> report.txt
echo "Branch: ${{ github.ref }}" >> report.txt
echo "Deployment Status: Failed" >> report.txt
echo "Error Details: ${{ job.status }}" >> report.txt
echo "===================" >> report.txt
cat report.txt
- name: Upload Error Report
if: failure()
uses: actions/upload-artifact@v3
with:
name: deployment-error-report
path: report.txt