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
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 55s
This commit is contained in:
@@ -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 🎆"
|
||||
Reference in New Issue
Block a user