Skip to content

Merge pull request #19 from openstreetmap-polska/dev #20

Merge pull request #19 from openstreetmap-polska/dev

Merge pull request #19 from openstreetmap-polska/dev #20

Workflow file for this run

name: deploy-main
on:
push:
branches:
- main
paths-ignore:
- "*.md"
jobs:
deploy:
name: Deploy main
runs-on: ubuntu-latest
steps:
- name: Install SSH key
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
ssh-host: ${{ secrets.SSH_HOST_NEW_IP }}
ssh-port: ${{ secrets.SSH_HOST_NEW_PORT }}
- name: Build and deploy
run: |
ssh -p ${{ secrets.SSH_HOST_NEW_PORT }} -l ${{ secrets.SSH_USER_NEW }} ${{ secrets.SSH_HOST_NEW_IP }} << EOF
set -e
echo "Navigating to the project directory"
cd /home/${{ secrets.SSH_USER_NEW }}/main/
echo "Fetching latest changes from the repository"
git fetch origin main
echo "Switching branches"
git checkout main
echo "Resetting to the latest commit"
git reset --hard origin/main
echo "Building and starting containers"
LISTEN=49222 docker compose up -d --build
EOF