-
Notifications
You must be signed in to change notification settings - Fork 4
36 lines (28 loc) · 1.1 KB
/
update-zone.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Workflow used for daily updates of the .ch zone file
name: update-zone
# Controls when the workflow will run
on:
schedule:
- cron: '45 0 * * *'
jobs:
update-zone:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# make sure dig is installed
- name: Install package dnsutils
run: sudo apt-get install dnsutils
# do the zone transfer
- name: Zone transfer
run: dig -y hmac-sha512:tsig-zonedata-ch-public-21-01:stZwEGApYumtXkh73qMLPqfbIDozWKZLkqRvcjKSpRnsor6A6MxixRL6C2HeSVBQNfMW4wer+qjS0ZSfiWiJ3Q== @zonedata.switch.ch +noall +answer +noidnout +onesoa AXFR ch. > ch.txt
# extract domains
- name: Extract domains
run: grep -P "IN\tNS" ch.txt | awk '{print $1}' | sort | uniq > ch_uniq.txt
# commit back to repo
- name: Commit new domains
run: |
git config --global user.name 'Antoine Neuenschwander'
git config --global user.email '[email protected]'
git add ch_uniq.txt
git commit -m $(head -1 ch.txt | awk '{print $7}')
git push