Adding 'Executing the migrations' subsection into README.md. Adding log messages on deploy.yml.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 55s

This commit is contained in:
Maxime Delporte
2025-10-31 12:05:53 +01:00
parent 80800b214c
commit 10ea699625
2 changed files with 26 additions and 1 deletions

View File

@@ -25,10 +25,12 @@ jobs:
- name: Add host key to known_hosts
run: |
echo "Creating access 🔐"
mkdir -p ~/.ssh
echo "${{ secrets.RUNNER_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -p ${{ secrets.SERVER_PORT }} -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
echo "Access created ✅"
- name: Applying database migrations
run: |
@@ -51,17 +53,23 @@ jobs:
- name: Build API
run: |
echo "Building API ⚙️"
go mod tidy
go build -o ./bin/greenlight-api ./cmd/api
echo "Build created ✅"
- name: Deploy to server
run: |
echo "Deployment ongoing 🔥"
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} "rm -rf /var/www/greenlight/*"
rsync -avz --delete -e "ssh -p ${{ secrets.SERVER_PORT }}" bin/ ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }}:/var/www/greenlight
echo "App deployed ✅"
- name: Launch API
run: |
echo "Launching API 🚀"
ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_IP }} "\
pkill greenlight-api || true; \
nohup /var/www/greenlight/greenlight-api > /var/www/greenlight/greenlight.log 2>&1 & \
"
"
echo "App deployed 🎆"