on: push: branches: - 'master' jobs: tests-and-sync: runs-on: linux_amd64 steps: - name: Retrieve files shell: bash run: | git clone ${{ gitea.server_url }}/${{ gitea.repository }} dns - name: Test files shell: bash run: | cd dns files=$(git diff-tree --no-commit-id --name-only -r master | grep "*.zone") for file in $files do domain=$(echo $file | sed "s/.zone//g") /usr/sbin/named-checkzone "$domain" "$file" || exit 2 done echo $(git diff-tree --no-commit-id --name-only -r master | grep "*.zone") > /var/cache/bind/.modified - run: echo "Job ended with status '${{ job.status }}'." sync: runs-on: linux_amd64 steps: - name: Retrieve files shell: bash run: | git clone ${{ gitea.server_url }}/${{ gitea.repository }} dns - name: Sync files shell: bash run: | cd dns files=$(cat /var/cache/bind/.modified) if [ -z "$files" ]; then files=$(find . -name "*.zone" -printf %P) fi for file in $files do cp -f "$file" "/var/cache/bind/$file" done deploiement: runs-on: linux_amd64 steps: - name: Reload bind shell: bash run: | sudo systemctl reload bind9.service - name: Check bind shell: bash run: | echo Recherche de zones déployées cd /var/cache/bind/.modified files=$(cat /var/cache/bind/.modified) count=$(cat /var/cache/bind/.modified | wc -l) linecount=$(( count * 5 + 3)) echo "Vérification des zones $files..." sudo grep named /var/log/syslog | tail -n $linecount | grep "reloading configuration succeeded" || exit 4 sudo grep named /var/log/syslog | tail -n $linecount | grep "reloading zones succeeded" || exit 5 sudo grep named /var/log/syslog | tail -n $linecount | grep "all zones loaded" || exit 6 sudo grep named /var/log/syslog | tail -n $linecount | grep "running" || exit 7 echo "Déploiement terminé."