This repository has been archived on 2024-07-30. You can view files and clone it, but cannot push or open issues or pull requests.
Auto-Homelab/.forgejo/workflows/CD.yml

30 lines
677 B
YAML
Raw Normal View History

2024-06-09 00:24:27 -04:00
name: Continuous Deployment
on:
push:
branches:
- main
jobs:
deploy:
2024-06-09 00:37:15 -04:00
runs-on: docker
2024-06-09 00:24:27 -04:00
steps:
- name: Checkout repository
uses: actions/checkout@v4
2024-06-09 00:36:54 -04:00
- name: Configure SSH Key
2024-06-09 00:38:22 -04:00
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
2024-06-09 00:24:27 -04:00
- name: Deploy to Hosts
run: |
2024-06-09 00:36:54 -04:00
for folder in $(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | cut -d/ -f1 | sort | uniq)
2024-06-09 00:24:27 -04:00
do
2024-06-09 00:51:41 -04:00
echo "Deploying to $folder"
./scripts/deploy.sh $folder
2024-06-09 00:29:45 -04:00
done
2024-06-09 01:06:52 -04:00
2024-06-09 01:08:48 -04:00
echo "Deployment for $folder completed successfully"