dns.yml runs DNSControl on kasse's host runner with the repo secret CLOUDFLARE_API_TOKEN: check and preview on any push touching dns/, push only from Run workflow on main, so a merge is never the cutover. Push events only; the repo is public. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5fbDmSQSb6u27EiEuwzoM
This commit is contained in:
2 files changed
+74
-2
No files matched your search
@@ -0,0 +1,61 @@
|
||||
# tomtervel.no's DNS: dns/dnsconfig.js, applied to Cloudflare by
|
||||
# DNSControl on kasse's host runner. A push that touches dns/, on any
|
||||
# branch, shows what would change (`preview`) and changes nothing. The
|
||||
# change itself is a person's: Actions -> dns -> Run workflow, on main.
|
||||
# So merging is not the cutover; pressing the button is.
|
||||
#
|
||||
# Push only, never pull_request: the repo is public, and a stranger's pull
|
||||
# request must not run on kasse with the token. The token is the repo
|
||||
# secret CLOUDFLARE_API_TOKEN, DNS edit for tomtervel.no only
|
||||
# (dns/README.md).
|
||||
name: dns
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- dns/**
|
||||
- .gitea/workflows/dns.yml
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
dns:
|
||||
runs-on: fish
|
||||
env:
|
||||
DNSCONTROL_VERSION: 5.7.2
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
steps:
|
||||
- name: checkout
|
||||
run: |
|
||||
rm -rf checkout
|
||||
git clone --depth 1 --branch "${{ github.ref_name }}" "${{ github.server_url }}/${{ github.repository }}.git" checkout
|
||||
|
||||
# The release binary, checked against the release's own checksums,
|
||||
# kept beside the portal lint so each version is fetched once.
|
||||
- name: dnscontrol
|
||||
run: |
|
||||
bin="/var/local/cargo-target/dnscontrol-$DNSCONTROL_VERSION"
|
||||
if [ ! -x "$bin" ]; then
|
||||
tmp=$(mktemp -d)
|
||||
base="https://github.com/StackExchange/dnscontrol/releases/download/v$DNSCONTROL_VERSION"
|
||||
tar="dnscontrol_${DNSCONTROL_VERSION}_linux_amd64.tar.gz"
|
||||
curl -sfL "$base/$tar" -o "$tmp/$tar"
|
||||
curl -sfL "$base/checksums.txt" -o "$tmp/checksums.txt"
|
||||
(cd "$tmp" && grep " $tar\$" checksums.txt | sha256sum -c -)
|
||||
tar -xzf "$tmp/$tar" -C "$tmp" dnscontrol
|
||||
install -m 0755 "$tmp/dnscontrol" "$bin"
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
"$bin" version
|
||||
echo "DNSCONTROL=$bin" >> "$GITHUB_ENV"
|
||||
|
||||
- name: check
|
||||
working-directory: checkout/dns
|
||||
run: $DNSCONTROL check
|
||||
|
||||
- name: preview
|
||||
working-directory: checkout/dns
|
||||
run: $DNSCONTROL preview
|
||||
|
||||
- name: push
|
||||
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
|
||||
working-directory: checkout/dns
|
||||
run: $DNSCONTROL push
|
||||
Reference in new issue
Block a user