Jafner.net/.gitea/workflows/homelab_deploy-to-druid.yml

55 lines
1.8 KiB
YAML
Raw Normal View History

2024-02-13 20:54:49 -08:00
name: Deploy to Druid
run-name: ${{ gitea.actor }} deploying
on:
push:
paths:
- '**/homelab/druid/**'
2024-02-13 20:54:49 -08:00
jobs:
2024-02-14 10:36:48 -08:00
Deploy:
2024-02-13 20:54:49 -08:00
runs-on: druid
steps:
2024-02-14 10:36:48 -08:00
- name: Pull latest code onto host via SSH
2024-02-13 20:54:49 -08:00
uses: appleboy/ssh-action@master
with:
host: ${{ vars.SSH_HOST_IP_DRUID }} # this is a LAN IP
username: ${{ vars.SSH_USERNAME_DRUID }}
key: ${{ secrets.SSH_KEY_DEPLOY_TO_DRUID }}
script: |
cd ~/homelab
git pull
- name: Validate compose configs
uses: appleboy/ssh-action@master
with:
host: ${{ vars.SSH_HOST_IP_DRUID }} # this is a LAN IP
username: ${{ vars.SSH_USERNAME_DRUID }}
key: ${{ secrets.SSH_KEY_DEPLOY_TO_DRUID }}
script: |
for stack in /home/$USER/homelab/druid/config/*
do cd $stack &&
echo "===== Validating $(basename $PWD) =====" &&
docker compose config > /dev/null
done
2024-02-15 01:47:30 -08:00
- name: Deploy new config
uses: appleboy/ssh-action@master
with:
host: ${{ vars.SSH_HOST_IP_DRUID }} # this is a LAN IP
username: ${{ vars.SSH_USERNAME_DRUID }}
key: ${{ secrets.SSH_KEY_DEPLOY_TO_DRUID }}
script: |
for stack in /home/$USER/homelab/druid/config/*
do cd $stack &&
echo "===== Deploying $(basename $PWD) =====" &&
docker compose up -d
done
2024-02-13 20:54:49 -08:00
Notify:
runs-on: druid
steps:
- name: Discord notification
uses: appleboy/discord-action@master
with:
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
args: '<@${{ secrets.DISCORD_ID_JAFNER }}> ${{ github.repository }} deploy to druid: ${{ job.status }}'