feat: implement the game endpoint #5
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: Build, Test and Deploy backend | |
on: | |
# opening a pull request to master and develop branch will be a trigger | |
pull_request: | |
branches: | |
- develop | |
# any code pushed to master and develop branch will also be a trigger | |
push: | |
branches: | |
- develop | |
jobs: | |
build-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Injecting environment vars | |
run: | | |
echo "${{ secrets.TEST_SECRETS }}" >> .env | |
- name: Building Docker containers | |
run: | | |
docker-compose up -d --build | |
docker-compose logs | |
# - name: Running Tests inside Docker containers | |
# run: | | |
# docker-compose exec -T api pytest | |
deploy: | |
name: Deploying on EC2 via SSH | |
if: ${{ github.event_name == 'push' }} | |
needs: [build-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploying Application on EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_EC2_IP }} | |
username: ${{ secrets.SSH_EC2_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
passphrase: ${{ secrets.SSH_PASSPHRASE }} | |
script: | | |
cd ~/.scripts | |
./docker-ec2-deploy.sh |