-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (42 loc) · 1.32 KB
/
update-dns.yaml
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
36
37
38
39
40
41
42
43
44
45
46
47
name: Update DNS records
on:
push:
branches:
- main
paths:
- 'zonefiles/**.zone'
jobs:
validate-zonefiles:
uses: ./.github/workflows/validate-zonefiles.yaml
update-dns:
needs:
- validate-zonefiles
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Install cli53
run: |
set -e
mkdir -p $HOME/bin
curl -Lsf -o $HOME/bin/cli53 https://github.com/barnybug/cli53/releases/download/$CLI53_RELEASE/cli53-linux-amd64
chmod 755 $HOME/bin/cli53
env:
CLI53_RELEASE: "0.8.22"
- name: Update zones
run: |
set -e
(
git diff-tree --no-commit-id --diff-filter=ACRM --name-only -r HEAD^ HEAD -- '*.zone' ||
git diff-tree --no-commit-id --diff-filter=ACRM --name-only -r --root HEAD -- '*.zone'
) | while read zonefile; do
zone=${zonefile##*/}
zone=${zone%.zone}
$HOME/bin/cli53 import --replace -n --file $zonefile $zone &&
$HOME/bin/cli53 import --replace --file $zonefile $zone
done
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}