2023-10-24 18:04:11 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2023-10-25 00:53:02 +02:00
|
|
|
- 'main'
|
2023-10-24 18:04:11 +02:00
|
|
|
|
|
|
|
jobs:
|
2024-08-20 15:16:28 +02:00
|
|
|
deploy_script:
|
2023-10-24 18:04:11 +02:00
|
|
|
runs-on: linux_amd64
|
|
|
|
steps:
|
2024-08-20 16:45:39 +02:00
|
|
|
- name: Apply zone changes
|
2023-10-24 18:04:11 +02:00
|
|
|
shell: bash
|
2024-08-20 16:46:54 +02:00
|
|
|
run: echo "Preparing to update ${{ vars.DNS_SERVER }}...";
|
2024-08-20 16:45:39 +02:00
|
|
|
echo "Finished."
|
2024-08-20 16:29:15 +02:00
|
|
|
# run: git diff HEAD^ HEAD > zone_diff.txt
|
|
|
|
# while IFS= read -r line; do
|
|
|
|
# case "$line" in
|
|
|
|
# "--- "*".zone")
|
|
|
|
# CURRENT_ZONE=$(basename "$line" .zone | sed 's/--- //')
|
|
|
|
# ;;
|
|
|
|
# "+++"*)
|
|
|
|
# ;;
|
|
|
|
# "-"* | "+"*)
|
|
|
|
# if [[ $line == -* ]]; then # Enregistrement supprimé
|
|
|
|
# RECORD=$(echo "$line" | sed 's/^-//')
|
|
|
|
# echo - $RECORD
|
2024-08-20 15:16:28 +02:00
|
|
|
# echo nsupdate -k $TSIG_KEY <<EOF
|
|
|
|
# server $DNS_SERVER
|
|
|
|
# zone $CURRENT_ZONE
|
|
|
|
# update delete $RECORD
|
|
|
|
# send
|
|
|
|
# EOF
|
2024-08-20 16:29:15 +02:00
|
|
|
# elif [[ $line == +* ]]; then # Enregistrement ajouté
|
|
|
|
# RECORD=$(echo "$line" | sed 's/^+//')
|
|
|
|
# echo + $RECORD
|
2024-08-20 15:16:28 +02:00
|
|
|
# nsupdate -k $TSIG_KEY <<EOF
|
|
|
|
# server $DNS_SERVER
|
|
|
|
# zone $CURRENT_ZONE
|
|
|
|
# update add $RECORD
|
|
|
|
# send
|
|
|
|
# EOF
|
2024-08-20 16:29:15 +02:00
|
|
|
# fi
|
|
|
|
# ;;
|
|
|
|
# esac
|
|
|
|
# done < zone_diff.txt
|