-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (54 loc) · 1.94 KB
/
Copy pathdns.yml
File metadata and controls
57 lines (54 loc) · 1.94 KB
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
48
49
50
51
52
53
54
55
56
57
name: DNS
on:
workflow_dispatch:
inputs:
mode:
description: plan or apply
required: true
default: plan
concurrency:
group: dns-docs.tigrbl.com
cancel-in-progress: false
jobs:
dns:
runs-on: deployment
environment: deployment
env:
NPM_BASE_URL: ${{ secrets.NPM_BASE_URL }}
NPM_IDENTITY: ${{ secrets.NPM_IDENTITY }}
NPM_SECRET: ${{ secrets.NPM_SECRET }}
NPM_TIMEOUT_S: 30
NAMECHEAP_API_USER: ${{ secrets.NAMECHEAP_API_USER }}
NAMECHEAP_API_KEY: ${{ secrets.NAMECHEAP_API_KEY }}
NAMECHEAP_USERNAME: ${{ secrets.NAMECHEAP_USERNAME }}
NAMECHEAP_CLIENT_IP: ${{ secrets.NAMECHEAP_CLIENT_IP }}
SITE_SERVER_IP: ${{ secrets.SITE_SERVER_IP }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install npmctl from PyPI
run: python -m pip install --upgrade "npmctl>=0.3.10" "npmctl-namecheap>=0.3.10"
- name: Render DNS desired state
shell: bash
run: |
if [ -z "${SITE_SERVER_IP}" ]; then
echo "Set SITE_SERVER_IP secret for DNS records."
exit 1
fi
mkdir -p .tmp
sed "s/__SITE_SERVER_IP__/${SITE_SERVER_IP}/g" desired-state/dns.yaml > .tmp/dns.yaml
- name: Validate desired DNS state
run: npmctl validate .tmp/dns.yaml
- name: Validate Namecheap provider
run: npmctl dns doctor --provider namecheap
- name: Normalize Namecheap DNS records
if: ${{ github.event.inputs.mode == 'apply' }}
run: python scripts/namecheap-normalize-dns.py .tmp/dns.yaml
- name: Plan Namecheap DNS with npmctl
if: ${{ github.event.inputs.mode != 'apply' }}
run: npmctl plan .tmp/dns.yaml --owner docs-tigrbl-com
- name: Apply Namecheap DNS with npmctl
continue-on-error: true
run: npmctl apply .tmp/dns.yaml --owner docs-tigrbl-com