no ifs, deploy without appleboy/ssh-action
This commit is contained in:
+16
-16
@@ -13,10 +13,6 @@ jobs:
|
||||
# ── BUILD SERVER ─────────────────────────────────────────────────────────────
|
||||
build-server:
|
||||
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:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -45,10 +41,6 @@ jobs:
|
||||
# ── BUILD WEBCLIENT ───────────────────────────────────────────────────────────
|
||||
build-webclient:
|
||||
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:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -78,18 +70,26 @@ jobs:
|
||||
deploy:
|
||||
runs-on: docker1
|
||||
needs: [build-server, build-webclient]
|
||||
# Запускается даже если один из build-job-ов был пропущен
|
||||
if: always() && !failure() && !cancelled()
|
||||
steps:
|
||||
- name: Deploy via SSH
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_HOST }}
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
script: |
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Deploy
|
||||
run: |
|
||||
ssh -i ~/.ssh/deploy_key ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} bash << 'EOF'
|
||||
mkdir -p /opt/blockly3d
|
||||
cd /opt/blockly3d
|
||||
if [ ! -d .git ]; then
|
||||
git clone https://git.aggtaa.com/anton/blockly3d.git .
|
||||
else
|
||||
git pull origin main
|
||||
fi
|
||||
docker compose pull
|
||||
docker compose up -d --remove-orphans
|
||||
docker image prune -f
|
||||
EOF
|
||||
Reference in New Issue
Block a user