2023-05-28 10:35:04 +00:00
|
|
|
name: Deploy zones
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Deploy-Zones:
|
|
|
|
runs-on: debian-stable
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
|
|
|
run: apt-get update && apt-get install -y knot-dnsutils ssh-client
|
2023-05-28 10:40:21 +00:00
|
|
|
- name: Check out repository code
|
|
|
|
uses: actions/checkout@v3
|
2023-05-28 10:35:04 +00:00
|
|
|
- name: Build catalog zone
|
|
|
|
run: |
|
|
|
|
for zonefile in zones/*; do
|
|
|
|
zone=$(basename $zonefile .zone)
|
|
|
|
echo "Checking zone $zone..."
|
|
|
|
kzonecheck -v -o $zone $zonefile
|
|
|
|
echo $(echo -n $zone | sha1sum | cut -f1 -d' ').zones 0 IN PTR $zone. >> catalog-zones/dns-witch-catalog.zone
|
|
|
|
done
|
|
|
|
- name: Configure SSH client
|
|
|
|
run: |
|
|
|
|
eval `ssh-agent -s`
|
|
|
|
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
|
|
|
|
mkdir -p $HOME/.ssh
|
|
|
|
chmod 700 $HOME/.ssh
|
|
|
|
echo "${{ secret.SSH_KNOWN_HOSTS }}" >> $HOME/.ssh/known_hosts
|
|
|
|
echo "${{ secret.SSH_CONFIG }}" >> $HOME/.ssh/config
|
|
|
|
chmod 644 $HOME/.ssh/{known_hosts,config}
|
|
|
|
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV
|
|
|
|
- name: Deploy zones
|
|
|
|
run: |
|
|
|
|
scp -r zones catalog-zones ${SSH_PRIMARY_NS}:/var/lib/knot/
|
|
|
|
ssh ${SSH_PRIMARY_NS} /usr/sbin/knotc reload
|