no ifs, deploy without appleboy/ssh-action

This commit is contained in:
azykov@mail.ru
2026-06-26 22:46:12 +03:00
parent e2e9a357de
commit 1ba60a5dc3
+17 -17
View File
@@ -13,10 +13,6 @@ jobs:
# ── BUILD SERVER ───────────────────────────────────────────────────────────── # ── BUILD SERVER ─────────────────────────────────────────────────────────────
build-server: build-server:
runs-on: docker1 runs-on: docker1
if: |
contains(toJSON(github.event.commits.*.modified), 'server/') ||
contains(toJSON(github.event.commits.*.modified), 'pnpm-lock.yaml') ||
contains(toJSON(github.event.commits.*.modified), 'server.Dockerfile')
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -45,10 +41,6 @@ jobs:
# ── BUILD WEBCLIENT ─────────────────────────────────────────────────────────── # ── BUILD WEBCLIENT ───────────────────────────────────────────────────────────
build-webclient: build-webclient:
runs-on: docker1 runs-on: docker1
if: |
contains(toJSON(github.event.commits.*.modified), 'webclient/') ||
contains(toJSON(github.event.commits.*.modified), 'pnpm-lock.yaml') ||
contains(toJSON(github.event.commits.*.modified), 'webclient.Dockerfile')
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -78,18 +70,26 @@ jobs:
deploy: deploy:
runs-on: docker1 runs-on: docker1
needs: [build-server, build-webclient] needs: [build-server, build-webclient]
# Запускается даже если один из build-job-ов был пропущен
if: always() && !failure() && !cancelled() if: always() && !failure() && !cancelled()
steps: steps:
- name: Deploy via SSH - name: Setup SSH
uses: appleboy/ssh-action@v1 run: |
with: mkdir -p ~/.ssh
host: ${{ secrets.DEPLOY_HOST }} echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
username: ${{ secrets.DEPLOY_USER }} chmod 600 ~/.ssh/deploy_key
key: ${{ secrets.DEPLOY_SSH_KEY }} ssh-keyscan ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
script: |
- name: Deploy
run: |
ssh -i ~/.ssh/deploy_key ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} bash << 'EOF'
mkdir -p /opt/blockly3d
cd /opt/blockly3d cd /opt/blockly3d
git pull origin main if [ ! -d .git ]; then
git clone https://git.aggtaa.com/anton/blockly3d.git .
else
git pull origin main
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