2023-05-28 10:35:04 +00:00
|
|
|
name: Deploy zones
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Deploy-Zones:
|
|
|
|
runs-on: debian-stable
|
|
|
|
steps:
|
|
|
|
- name: Install dependencies
|
2023-05-28 10:41:56 +00:00
|
|
|
run: apt-get update && apt-get install -y knot-dnsutils ssh-client git
|
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`
|
2023-05-28 10:54:57 +00:00
|
|
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' | ssh-add -
|
2023-05-28 10:35:04 +00:00
|
|
|
mkdir -p $HOME/.ssh
|
|
|
|
chmod 700 $HOME/.ssh
|
2023-05-28 10:49:48 +00:00
|
|
|
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> $HOME/.ssh/known_hosts
|
|
|
|
echo "${{ secrets.SSH_CONFIG }}" >> $HOME/.ssh/config
|
2023-05-28 10:35:04 +00:00
|
|
|
chmod 644 $HOME/.ssh/{known_hosts,config}
|
|
|
|
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV
|
|
|
|
- name: Deploy zones
|
|
|
|
run: |
|
2023-05-28 10:49:48 +00:00
|
|
|
scp -r zones catalog-zones ${{ secrets.SSH_PRIMARY_NS }}:/var/lib/knot/
|
|
|
|
ssh ${{ secrets.SSH_PRIMARY_NS }} /usr/sbin/knotc reload
|