39 lines
1.2 KiB
YAML
39 lines
1.2 KiB
YAML
name: Manual Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: Branch to deploy
|
|
required: true
|
|
default: main
|
|
target_dir:
|
|
description: Target directory on server
|
|
required: true
|
|
default: /srv/egbim_homepage
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup SSH key
|
|
shell: bash
|
|
run: |
|
|
install -m 700 -d ~/.ssh
|
|
printf '%s\n' '${{ secrets.DEPLOY_SSH_KEY }}' > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
ssh-keyscan -p '${{ secrets.DEPLOY_PORT }}' '${{ secrets.DEPLOY_HOST }}' >> ~/.ssh/known_hosts
|
|
|
|
- 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'
|
|
|
|
- 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 }}'" |