From 2e40af43506383557b12b494363aa86865674560 Mon Sep 17 00:00:00 2001 From: "Adrien Bourmault (neox)" Date: Sat, 28 Sep 2024 12:21:28 +0200 Subject: [PATCH] CI: supprimer avant d'ajouter --- .forgejo/workflows/ci.yaml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 7219b8c..a5d6446 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -39,7 +39,27 @@ jobs: echo -e "server ${{vars.DNS_SERVER}}\nttl 3600\nupdate add $RECORD\nsend" > temp_delete nsupdate -k temp_keyfile temp_delete rm temp_delete - elif [[ $line == +* ]]; then # Enregistrement ajouté + fr + fi + ;; + esac + done < zone_diff.txt + while IFS= read -r line; do + #echo "* line: $line" + case "$line" in + "--- "*".zone") + NAME=$(echo "$line" .zone | sed 's/--- //' | sed 's|a/||') + CURRENT_ZONE=$(basename $NAME) + echo "*** Updating $CURRENT_ZONE" + ;; + "--- "*) + CURRENT_ZONE= + ;; + "+++"*) + ;; + "-"*IN* | "+"*IN*) + if [ ! -z $CURRENT_ZONE ]; then + if [[ $line == +* ]]; then # Enregistrement ajouté RECORD=$(echo "$line" | sed 's/^+//' | sed "s/^\([^ ]\+\)\(\s\+\)\(IN\s\+\)\([^ ]\+\)\(\s\+\)/\1.${CURRENT_ZONE}.\2\3\4\5/" | sed 's/@.//') echo "update add $RECORD" echo -e "server ${{vars.DNS_SERVER}}\nttl 3600\nupdate add $RECORD\nsend" > temp_add @@ -51,4 +71,4 @@ jobs: esac done < zone_diff.txt rm temp_keyfile - echo ${{ env.GITHUB_SHA }} > /home/runner/last_run \ No newline at end of file + echo ${{ env.GITHUB_SHA }} > /home/runner/last_run