diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17aa3e7..97a8b29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,17 @@ jobs: with: node-version: "18" + - name: "Create Back-end .env File" + run: | + touch .env + echo FRONT_END_DOMAIN=${{ secrets.FRONT_END_DOMAIN }} >> .env + echo REACT_APP_BACKEND=${{ secrets.REACT_APP_BACKEND }} >> .env + echo JWT_SECRET=${{ secrets.JWT_SECRET }} >> .env + echo JWT_EXP_DAYS=${{ secrets.JWT_EXP_DAYS }} >> .env + echo MONGODB_URI=${{ secrets.MONGODB_URI }} >> .env + echo AVATAR_GENERATOR=${{ secrets.AVATAR_GENERATOR }} >> .env + working-directory: ./back-end + - name: Install front-end dependencies run: | cd front-end @@ -31,30 +42,10 @@ jobs: cd back-end npm install - - name: List contents of the models directory - run: ls -l ./back-end/models/ - - # - name: Run back-end tests - # run: | - # cd back-end - # npm test + - name: Run back-end tests + run: | + cd back-end + npm test # - name: Build and run Docker containers # run: docker-compose up --build - - - name: Deploy React and Express App - uses: appleboy/ssh-action@master - with: - host: ${{ secrets.DROPLET_IP }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - username: ${{ secrets.SSH_USER }} - script: | - cd 4-final-project-group-bill-splitting-app - git pull - cd front-end - npm install - npm start - cd ../back-end - npm install - npm start - echo 'Success' diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index b534bcb..7260d29 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -25,11 +25,15 @@ jobs: username: ${{ secrets.SSH_USER }} script: | cd 4-final-project-group-bill-splitting-app - git pull - cd front-end - npm install - npm start - cd ../back-end - npm install - npm start - echo 'Success' + git pull origin master + docker-compose down + docker-compose up --build -d + + # git pull + # cd front-end + # npm install + # npm start + # cd ../back-end + # npm install + # npm start + # echo 'Success'