27 lines
757 B
YAML
27 lines
757 B
YAML
name: Deploy to Hosts
|
|
on:
|
|
pull_request:
|
|
types: [closed]
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: docker
|
|
if: github.event.pull_request.merged == true
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Configure SSH Key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
- name: Deploy to Hosts
|
|
run: |
|
|
for folder in $(git diff-tree --no-commit-id --name-only -r "${{ github.event.pull_request.merge_commit_sha }}" | cut -d/ -f1 | sort | uniq)
|
|
do
|
|
echo "Deploying to $folder"
|
|
./scripts/deploy.sh "$folder"
|
|
echo "Deployment for $folder completed successfully"
|
|
done
|