chore: content update #21
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: Deploy website on production server | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
checkout: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: checkout | |
environment: prod | |
steps: | |
- name: Deploy to DigitalOcean droplet | |
env: | |
DO_SERVER_IP: ${{ secrets.DO_SERVER_IP }} | |
DO_SERVER_USER: ${{ secrets.DO_SERVER_USER }} | |
DO_SERVER_PASSWORD: ${{ secrets.DO_SERVER_PASSWORD }} | |
ENV_PROD: ${{ secrets.ENV_PROD }} | |
run: | | |
sudo apt-get update && sudo apt-get install -y openssh-client sshpass | |
mkdir -p ~/.ssh | |
ssh-keyscan -H "$DO_SERVER_IP" >> ~/.ssh/known_hosts | |
sshpass -p "$DO_SERVER_PASSWORD" ssh $DO_SERVER_USER@$DO_SERVER_IP << EOF | |
cd /home/project/tedxlublin/ | |
git pull origin main | |
echo "$ENV_PROD" | base64 --decode > .env.prod | |
docker compose --file docker-compose.prod.yaml up --build -d | |
EOF |