Skip to content

fix: deploy.yml

fix: deploy.yml #76

Workflow file for this run

name: Deploy
on:
push:
branches: [ main-banana ]
env:
SERVER_HOST: 109.172.81.237
SERVER_PORT: 22
SERVER_USER: root
SERVER_PATH: /home/teamapp
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
touch .env.prod
echo "${{ secrets.ENV }}" > .env.prod
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml push
- name: SSH Connection
run: |

Check failure on line 36 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / Deploy

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 36, Col: 14): Unrecognized named-value: 'SERVER_PATH'. Located at position 1 within expression: SERVER_PATH
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ../private.key
sudo chmod 600 ../private.key
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
echo "${{ secrets.SSH_PASSPHRASE }}" | ssh-agent bash -c "ssh-add ../private.key; ssh -o StrictHostKeyChecking=no -tt ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }}"
cd ${{ SERVER_PATH }} && docker-compose down || mkdir ${{ SERVER_PATH }} && cd ${{ SERVER_PATH }} && git clone https://github.com/SoftBananas/teamapp-backend.git
git pull
docker-compose up -d
shell: bash
env:
SSH_PRIVATE_KEY: ${{secrets.SSH_KEY}}
SSH_KNOWN_HOSTS: ${{secrets.SSH_KNOWN_HOSTS}}
SSH_KEY_PATH: ${{ github.workspace }}/../private.key