fix: merge deploy step into build-and-push job to avoid runner mismatch
Build & Deploy / build-and-push (discord-gateway) (push) Failing after 2m1s
Build & Deploy / build-and-push (backend) (push) Successful in 6m54s
Build & Deploy / build-and-push (proxy) (push) Failing after 5m30s

The separate 'deploy' job with runs-on: ubuntu-latest never
found an available runner, blocking the pipeline. By moving
the deploy steps into the build-and-push job (guarded by
matrix.service == 'proxy'), it runs on the same runner that
just pushed the images, eliminating the runner assignment issue.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Developer
2026-07-27 22:01:05 +07:00
co-authored by Claude Opus 4.8
parent 5802d02e29
commit 5d1842b7e5
+7 -11
View File
@@ -47,25 +47,21 @@ jobs:
docker push $IMG:${{ github.sha }} docker push $IMG:${{ github.sha }}
docker push $IMG:latest docker push $IMG:latest
deploy: - name: Deploy (proxy only — after all pushes)
needs: build-and-push if: matrix.service == 'proxy' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Install SSH
run: |
apt-get update -qq
apt-get install -y -qq --no-install-recommends openssh-client ca-certificates
- name: Deploy
env: env:
ENV_FILE: ${{ secrets.ENV_FILE }} ENV_FILE: ${{ secrets.ENV_FILE }}
SSH_KEY: ${{ secrets.VPS_SSH_KEY }} SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
VPS_USER: ${{ secrets.VPS_USER }}
VPS_HOST: ${{ secrets.VPS_HOST }}
run: | run: |
set -eu set -eu
apt-get update -qq
apt-get install -y -qq --no-install-recommends openssh-client ca-certificates
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "$SSH_KEY" > ~/.ssh/id_ed25519 echo "$SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
ENV_B64=$(echo "$ENV_FILE" | base64 -w0) ENV_B64=$(echo "$ENV_FILE" | base64 -w0)
ssh -o StrictHostKeyChecking=accept-new \ ssh -o StrictHostKeyChecking=accept-new \
${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} \ "$VPS_USER@$VPS_HOST" \
"cd /opt/imphenbot/infra/docker && echo '$ENV_B64' | base64 -d > .env && docker compose pull && docker compose up -d --remove-orphans && docker image prune -f" "cd /opt/imphenbot/infra/docker && echo '$ENV_B64' | base64 -d > .env && docker compose pull && docker compose up -d --remove-orphans && docker image prune -f"