mirror of
https://github.com/arthur-pbty/links.git
synced 2026-08-01 20:29:27 +02:00
update runner
This commit is contained in:
@@ -1,42 +1,27 @@
|
||||
name: Deploy to VM Prod
|
||||
name: Deploy Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Deploy to production
|
||||
- name: Deploy on server
|
||||
run: |
|
||||
REPO_NAME=${{ github.event.repository.name }}
|
||||
set -e
|
||||
|
||||
if [ -z "${{ secrets.ENV_FILE }}" ]; then
|
||||
ENV_CONTENT=""
|
||||
else
|
||||
ENV_CONTENT="${{ secrets.ENV_FILE }}"
|
||||
fi
|
||||
echo "Go to app folder"
|
||||
cd /opt/apps/links
|
||||
|
||||
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "
|
||||
mkdir -p /srv/$REPO_NAME
|
||||
cd /srv/$REPO_NAME
|
||||
echo "Pull latest code"
|
||||
git pull origin main
|
||||
|
||||
if [ ! -d .git ]; then
|
||||
rm -rf ./* # vide le dossier si nécessaire
|
||||
git clone https://github.com/arthur-pbty-labs/$REPO_NAME .
|
||||
else
|
||||
git reset --hard
|
||||
git pull origin main
|
||||
fi
|
||||
echo "Build & restart containers"
|
||||
docker compose down || true
|
||||
docker compose build
|
||||
docker compose up -d
|
||||
|
||||
if [ -n \"$ENV_CONTENT\" ]; then
|
||||
echo \"$ENV_CONTENT\" > .env
|
||||
fi
|
||||
|
||||
docker compose up -d --build
|
||||
"
|
||||
echo "Deploy finished"
|
||||
Reference in New Issue
Block a user