diff --git a/.forgejo/workflows/ci.yaml b/.forgejo/workflows/ci.yaml index 93b74af..8875711 100644 --- a/.forgejo/workflows/ci.yaml +++ b/.forgejo/workflows/ci.yaml @@ -4,48 +4,26 @@ on: - 'main' jobs: - tests: + sync: runs-on: linux_amd64 steps: - - name: Retrieve files + - name: Retrieve and sync files shell: bash run: | git clone ${{ gitea.server_url }}/${{ gitea.repository }} dns echo "Cloned sucessfully from ${{ gitea.server_url }}/${{ gitea.repository }}" - - name: Test files - shell: bash - run: | - cd dns files=$(git diff-tree --no-commit-id --name-only -r main | grep "*.zone") echo "Have to test $files" + echo "" > /var/cache/bind/.modified for file in $files do domain=$(echo $file | sed "s/.zone//g") - /usr/sbin/named-checkzone "$domain" "$file" || echo "Error on file $file" && exit 2 - done - echo $(git diff-tree --no-commit-id --name-only -r main | grep "*.zone") > /var/cache/bind/.modified - echo "Tested sucessfully" - - sync: - runs-on: linux_amd64 - needs: tests - 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 + /usr/sbin/named-checkzone "$domain" "$file" || echo "Error on file $file" && continue + echo "$file" >> /var/cache/bind/.modified cp -f "$file" "/var/cache/bind/$file" done + echo "Synced sucessfully" + deploiement: runs-on: linux_amd64