2024-02-13 10:55:45 -08:00
|
|
|
name: Deploy to Fighter
|
|
|
|
run-name: ${{ gitea.actor }} deploying
|
2024-05-28 13:20:12 -07:00
|
|
|
# on:
|
|
|
|
# push:
|
|
|
|
# paths:
|
|
|
|
# - 'fighter/**'
|
2024-02-13 10:55:45 -08:00
|
|
|
|
|
|
|
jobs:
|
2024-02-14 10:36:48 -08:00
|
|
|
Deploy:
|
2024-02-13 21:15:32 -08:00
|
|
|
runs-on: fighter
|
2024-02-13 10:55:45 -08:00
|
|
|
steps:
|
2024-02-14 10:36:48 -08:00
|
|
|
- name: Pull latest code onto host via SSH
|
2024-02-13 10:55:45 -08:00
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
2024-02-13 10:59:14 -08:00
|
|
|
host: ${{ vars.SSH_HOST_IP_FIGHTER }} # this is a LAN IP
|
|
|
|
username: ${{ vars.SSH_USERNAME_FIGHTER }}
|
|
|
|
key: ${{ secrets.SSH_KEY_DEPLOY_TO_FIGHTER }}
|
2024-02-13 10:55:45 -08:00
|
|
|
script: |
|
|
|
|
cd ~/homelab
|
|
|
|
git pull
|
2024-02-13 11:27:37 -08:00
|
|
|
- name: Validate compose configs
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ vars.SSH_HOST_IP_FIGHTER }} # this is a LAN IP
|
|
|
|
username: ${{ vars.SSH_USERNAME_FIGHTER }}
|
|
|
|
key: ${{ secrets.SSH_KEY_DEPLOY_TO_FIGHTER }}
|
|
|
|
script: |
|
|
|
|
for stack in /home/$USER/homelab/fighter/config/*
|
2024-02-13 12:55:59 -08:00
|
|
|
do cd $stack &&
|
|
|
|
echo "===== Validating $(basename $PWD) =====" &&
|
|
|
|
docker compose config > /dev/null
|
2024-02-13 11:27:37 -08:00
|
|
|
done
|
2024-02-15 01:12:44 -08:00
|
|
|
- name: Deploy new config
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ vars.SSH_HOST_IP_FIGHTER }} # this is a LAN IP
|
|
|
|
username: ${{ vars.SSH_USERNAME_FIGHTER }}
|
|
|
|
key: ${{ secrets.SSH_KEY_DEPLOY_TO_FIGHTER }}
|
|
|
|
script: |
|
2024-02-29 20:02:21 -08:00
|
|
|
chmod +x /home/admin/homelab/fighter/scripts/startup.sh
|
|
|
|
/home/admin/homelab/fighter/scripts/startup.sh
|
2024-02-15 01:20:38 -08:00
|
|
|
Notify:
|
|
|
|
runs-on: fighter
|
|
|
|
steps:
|
2024-02-15 01:36:20 -08:00
|
|
|
- name: Discord notification
|
|
|
|
uses: appleboy/discord-action@master
|
2024-02-15 01:20:38 -08:00
|
|
|
with:
|
2024-02-15 01:36:20 -08:00
|
|
|
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }}
|
|
|
|
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
|
2024-02-15 01:40:03 -08:00
|
|
|
args: '<@${{ secrets.DISCORD_ID_JAFNER }}> ${{ github.repository }} deploy to fighter: ${{ job.status }}'
|