배포 실행 파일 수정 DB 덤프 자동실행 추가

This commit is contained in:
root
2026-07-23 17:06:22 +09:00
parent 371ad1063d
commit b5801d149a
7 changed files with 317905 additions and 9 deletions
+20 -1
View File
@@ -11,6 +11,10 @@ on:
description: Target directory on server
required: true
default: /srv/egbim_homepage
db_dump_path:
description: SQL dump path inside repository
required: true
default: egbim_DB.sql
jobs:
deploy:
@@ -27,13 +31,28 @@ jobs:
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p '${{ secrets.DEPLOY_PORT }}' '${{ secrets.DEPLOY_HOST }}' >> ~/.ssh/known_hosts
- name: Render deployment env
shell: bash
run: |
cat > /tmp/egbim.deploy.env <<EOF
APP_ENV=${{ secrets.APP_ENV }}
APP_PORT=${{ secrets.APP_PORT }}
DB_PORT=${{ secrets.DB_PORT }}
G5_MYSQL_DB=${{ secrets.G5_MYSQL_DB }}
G5_MYSQL_USER=${{ secrets.G5_MYSQL_USER }}
G5_MYSQL_PASSWORD=${{ secrets.G5_MYSQL_PASSWORD }}
MARIADB_ROOT_PASSWORD=${{ secrets.MARIADB_ROOT_PASSWORD }}
COMPOSE_PROJECT_NAME=${{ secrets.COMPOSE_PROJECT_NAME }}
EOF
- name: Upload deployment script
shell: bash
run: |
scp -P '${{ secrets.DEPLOY_PORT }}' -i ~/.ssh/id_ed25519 scripts/deploy_remote.sh '${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/tmp/egbim_deploy_remote.sh'
scp -P '${{ secrets.DEPLOY_PORT }}' -i ~/.ssh/id_ed25519 /tmp/egbim.deploy.env '${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/tmp/egbim.deploy.env'
- name: Run deploy
shell: bash
run: |
ssh -p '${{ secrets.DEPLOY_PORT }}' -i ~/.ssh/id_ed25519 '${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}' \
"chmod +x /tmp/egbim_deploy_remote.sh && /tmp/egbim_deploy_remote.sh '${{ inputs.branch }}' '${{ inputs.target_dir }}'"
"chmod +x /tmp/egbim_deploy_remote.sh && /tmp/egbim_deploy_remote.sh '${{ inputs.branch }}' '${{ inputs.target_dir }}' /tmp/egbim.deploy.env '${{ inputs.db_dump_path }}'"