@@ -24,20 +24,30 @@ jobs:
2424 NAMECHEAP_API_KEY : ${{ secrets.NAMECHEAP_API_KEY }}
2525 NAMECHEAP_USERNAME : ${{ secrets.NAMECHEAP_USERNAME }}
2626 NAMECHEAP_CLIENT_IP : ${{ secrets.NAMECHEAP_CLIENT_IP }}
27+ SITE_SERVER_IP : ${{ secrets.SITE_SERVER_IP || secrets.SERVER_IP || secrets.DEPLOY_SERVER_IP }}
2728 steps :
2829 - uses : actions/checkout@v4
2930 - uses : actions/setup-python@v5
3031 with :
3132 python-version : ' 3.12'
3233 - name : Install npmctl from PyPI
3334 run : python -m pip install --upgrade npmctl npmctl-namecheap
35+ - name : Render DNS desired state
36+ shell : bash
37+ run : |
38+ if [ -z "${SITE_SERVER_IP}" ]; then
39+ echo "Set SITE_SERVER_IP, SERVER_IP, or DEPLOY_SERVER_IP secret for DNS A records."
40+ exit 1
41+ fi
42+ mkdir -p .tmp
43+ sed "s/__SITE_SERVER_IP__/${SITE_SERVER_IP}/g" desired-state/dns.yaml > .tmp/dns.yaml
3444 - name : Validate desired DNS state
35- run : npmctl validate desired-state /dns.yaml
45+ run : npmctl validate .tmp /dns.yaml
3646 - name : Validate Namecheap provider
3747 run : npmctl dns doctor --provider namecheap
3848 - name : Plan Namecheap DNS with npmctl
3949 if : ${{ github.event.inputs.mode != 'apply' }}
40- run : npmctl plan desired-state /dns.yaml --owner npmctl-com
50+ run : npmctl plan .tmp /dns.yaml --owner npmctl-com
4151 - name : Apply Namecheap DNS with npmctl
4252 if : ${{ github.event.inputs.mode == 'apply' }}
43- run : npmctl apply desired-state /dns.yaml --owner npmctl-com
53+ run : npmctl apply .tmp /dns.yaml --owner npmctl-com
0 commit comments