deploy directly to docker, not ssh

This commit is contained in:
azykov@mail.ru
2026-06-27 12:04:58 +03:00
parent bc98e23f6a
commit 793a7c9da3
+20 -20
View File
@@ -11,14 +11,18 @@ jobs:
# ── BUILD SERVER ────────────────────────────────────────────────────────────── # ── BUILD SERVER ──────────────────────────────────────────────────────────────
build-server: build-server:
runs-on: docker1 runs-on: docker1
defaults:
run:
working-directory: /workspace
steps: steps:
- name: Checkout - name: Checkout
working-directory: /
run: | run: |
if [ -d .git ]; then mkdir -p /workspace
git fetch origin main if [ -d /workspace/.git ]; then
git reset --hard origin/main cd /workspace && git fetch origin && git reset --hard origin/${{ gitea.ref_name }}
else else
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git . git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git /workspace
fi fi
- name: Build & push server - name: Build & push server
@@ -38,14 +42,18 @@ jobs:
# ── BUILD WEBCLIENT ─────────────────────────────────────────────────────────── # ── BUILD WEBCLIENT ───────────────────────────────────────────────────────────
build-webclient: build-webclient:
runs-on: docker1 runs-on: docker1
defaults:
run:
working-directory: /workspace
steps: steps:
- name: Checkout - name: Checkout
working-directory: /
run: | run: |
if [ -d .git ]; then mkdir -p /workspace
git fetch origin main if [ -d /workspace/.git ]; then
git reset --hard origin/main cd /workspace && git fetch origin && git reset --hard origin/${{ gitea.ref_name }}
else else
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git . git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git /workspace
fi fi
- name: Build & push webclient - name: Build & push webclient
@@ -68,23 +76,15 @@ jobs:
needs: [build-server, build-webclient] needs: [build-server, build-webclient]
if: always() && !failure() && !cancelled() if: always() && !failure() && !cancelled()
steps: steps:
- name: Deploy via SSH - name: Deploy
run: | run: |
mkdir -p ~/.ssh mkdir -p "/app-cache/${{ gitea.repository }}"
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key cd "/app-cache/${{ gitea.repository }}"
chmod 600 ~/.ssh/deploy_key
ssh-keyscan ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
ssh -i ~/.ssh/deploy_key ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} bash << 'EOF'
set -e
mkdir -p /opt/blockly3d
cd /opt/blockly3d
if [ ! -d .git ]; then if [ ! -d .git ]; then
git clone https://git.aggtaa.com/anton/blockly3d.git . git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
else else
git pull origin main git pull origin main
fi fi
docker compose pull docker compose pull
docker compose up -d --remove-orphans docker compose up -d --remove-orphans
docker image prune -f docker image prune -f
EOF