f
This commit is contained in:
parent
bf82ba32b2
commit
b2ae0478be
@ -6,7 +6,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
deploy_production:
|
deploy_production:
|
||||||
name: Deploy to Production
|
name: Deploy to Production
|
||||||
runs-on: ubuntu-latest
|
runs-on: self-hosted
|
||||||
environment:
|
environment:
|
||||||
name: production
|
name: production
|
||||||
|
|
||||||
@ -14,46 +14,11 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install SSH and rsync
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y --no-install-recommends openssh-client rsync
|
|
||||||
|
|
||||||
- name: Configure SSH
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa
|
|
||||||
chmod 600 ~/.ssh/id_rsa
|
|
||||||
|
|
||||||
- name: Ensure remote directory exists
|
|
||||||
run: |
|
|
||||||
ssh -o StrictHostKeyChecking=yes "${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}" \
|
|
||||||
"mkdir -p /opt/apps/api-finance"
|
|
||||||
|
|
||||||
- name: Sync repository to server
|
|
||||||
run: |
|
|
||||||
rsync -az --delete \
|
|
||||||
--exclude='.git' \
|
|
||||||
--exclude='.env' \
|
|
||||||
--exclude='.env.*' \
|
|
||||||
--exclude='node_modules' \
|
|
||||||
--exclude='coverage' \
|
|
||||||
--exclude='dist' \
|
|
||||||
./ "${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/opt/apps/api-finance/"
|
|
||||||
|
|
||||||
- name: Rebuild and restart Docker Compose
|
- name: Rebuild and restart Docker Compose
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=yes "${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}" "
|
|
||||||
set -e
|
set -e
|
||||||
cd /opt/apps/api-finance
|
|
||||||
docker compose -f docker-compose.server.yml pull
|
|
||||||
docker compose -f docker-compose.server.yml up -d --build
|
docker compose -f docker-compose.server.yml up -d --build
|
||||||
docker image prune -f
|
|
||||||
"
|
|
||||||
|
|
||||||
- name: Optional: Check service health
|
- name: 'Optional: Check service health'
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=yes "${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}" "
|
|
||||||
set -e
|
|
||||||
curl --fail --silent --show-error https://api-finance.ai-assistant-bot.xyz/ || exit 1
|
curl --fail --silent --show-error https://api-finance.ai-assistant-bot.xyz/ || exit 1
|
||||||
"
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user