Skip to content

Commit

Permalink
Merge pull request #719 from is-a-good-dev/move-to-dnscontrol
Browse files Browse the repository at this point in the history
feat(ci): move to dnscontrol
  • Loading branch information
Tweak4141 authored Oct 19, 2024
2 parents b84a12b + 6eb24b5 commit 3735954
Show file tree
Hide file tree
Showing 438 changed files with 3,032 additions and 3,382 deletions.
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
* @Tweak4141 @clarkedev

/sub-logs/* @is-a-good-dev/helpers
/domains/* @is-a-good-dev/helpers
/.github/* @Tweak4141
/scripts/* @Tweak4141
/utils/* @Tweak4141
/.github/workflows/* @Tweak4141 @wdhdev
/dnsconfig.js @Tweak4141 @wdhdev
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish

on:
push:
branches: [main]
paths:
- "domains/*"
- ".github/workflows/publish.yml"
- "dnsconfig.js"

workflow_dispatch:

concurrency:
group: ${{ github.ref }}-publish
cancel-in-progress: false

jobs:
dns:
name: DNS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Generate creds.json
run: echo '{"cloudflare":{"TYPE":"CLOUDFLAREAPI","apitoken":"$CLOUDFLARE_API_TOKEN"}}' > ./creds.json

- name: Publish
uses: is-a-dev/dnscontrol-action@main
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.API_KEY }}
with:
args: push
33 changes: 0 additions & 33 deletions .github/workflows/update-records.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Validation

on:
pull_request:

push:
branches: [main]
paths:
- "domains/*"
- ".github/workflows/validation.yml"
- "dnsconfig.js"

workflow_dispatch:

concurrency:
group: ${{ github.ref }}-validation
cancel-in-progress: true

jobs:
dns:
name: DNS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check
uses: is-a-dev/dnscontrol-action@main
with:
args: check

json:
name: JSON
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: JSON Syntax Check
uses: limitusus/json-syntax-check@v2
with:
pattern: "\\.json$"
env:
BASE: "domains/"
45 changes: 0 additions & 45 deletions .github/workflows/validation.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore

This file was deleted.

53 changes: 53 additions & 0 deletions dnsconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
function getDomainsList(filesPath) {
var result = [];
var files = glob.apply(null, [filesPath, true, ".json"]);

for (var i = 0; i < files.length; i++) {
var name = files[i].split("/").pop().replace(/\.json$/, "");

result.push({ name: name, data: require(files[i]) });
}

return result;
}

var domains = getDomainsList("./domains");
var commit = [];

for (var subdomain in domains) {
var subdomainName = domains[subdomain].name;
var domainData = domains[subdomain].data;
var proxyState = domainData.proxied ? { cloudflare_proxy: "on" } : { cloudflare_proxy: "off" };

// Handle A records
if (domainData.target.A) {
for (var a in domainData.target.A.value) {
commit.push(A(domainData.target.A.name, IP(domainData.target.A.value[a]), proxyState));
}
}

// Handle AAAA records
if (domainData.target.AAAA) {
for (var aaaa in domainData.target.AAAA.value) {
commit.push(AAAA(domainData.target.AAAA.name, domainData.target.AAAA.value[aaaa], proxyState));
}
}

// Handle CNAME records
if (domainData.target.CNAME) {
// Allow CNAME target on root
if (subdomainName === "@") {
commit.push(ALIAS(domainData.target.CNAME.name, domainData.target.CNAME.value + ".", proxyState));
} else {
commit.push(CNAME(domainData.target.CNAME.name, domainData.target.CNAME.value + ".", proxyState));
}
}

// Handle TXT records
if (domainData.target.TXT) {
commit.push(TXT(domainData.target.TXT.name === "@" ? subdomainName : domainData.target.TXT.name + "." + subdomainName, domainData.target.TXT.value));
}
}

// Commit all DNS records
D("is-a-good.dev", NewRegistrar("none"), DnsProvider(NewDnsProvider("cloudflare")), commit);
17 changes: 17 additions & 0 deletions domains/@.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"repo": "https://github.com/is-a-good-dev/register",

"owner": {
"username": "is-a-good-dev",
"email": "will@is-a-good.dev"
},

"target": {
"CNAME": {
"name": "@",
"value": "is-a-good-dev.github.io"
}
},

"proxied": false
}
17 changes: 17 additions & 0 deletions domains/aaron.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"repo": "https://github.com/Adriichu/is-a-good-dev",

"owner": {
"username": "Adriichuuu",
"email": "aaron@proton.me"
},

"target": {
"CNAME": {
"name": "aaron",
"value": "aaron-web.pages.dev"
}
},

"proxied": true
}
21 changes: 21 additions & 0 deletions domains/aayush.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"website": "https://opaayush.pages.dev",

"owner": {
"username": "OpAayush",
"email": "aayushmagrawal@gmail.com"
},

"target": {
"CNAME": {
"name": "aayush",
"value": "opaayush.pages.dev"
},
"TXT": {
"name": "_github-pages-challenge-OpAayush",
"value": "d9cdcc62ad8d21a614cf615bc2535b"
}
},

"proxied": false
}
17 changes: 17 additions & 0 deletions domains/abardia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"repo": "https://github.com/abardia/abardia.github.io",

"owner": {
"username": "abardia",
"email": "a.bardia@yahoo.de"
},

"target": {
"CNAME": {
"name": "abardia",
"value": "abardia.github.io"
}
},

"proxied": false
}
15 changes: 15 additions & 0 deletions domains/abderrazak-bahaj.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"owner": {
"username": "abderrazak",
"email": "bahajabde0@gmail.com"
},

"target": {
"CNAME": {
"name": "abderrazak-bahaj",
"value": "abderrazak-Baha.github.io"
}
},

"proxied": false
}
17 changes: 17 additions & 0 deletions domains/abdullah.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"repo": "https://github.com/abdullahnasir4/register",

"owner": {
"username": "AbdullahNasir",
"email": "abdullahnasir751@gmail.com"
},

"target": {
"CNAME": {
"name": "Abdullah",
"value": "abdullah.github.io"
}
},

"proxied": false
}
15 changes: 15 additions & 0 deletions domains/acey.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"owner": {
"username": "AceyDoCodes",
"email": "aceygoesboom@gmail.com"
},

"target": {
"CNAME": {
"name": "acey",
"value": "cname.vercel-dns.com"
}
},

"proxied": false
}
File renamed without changes.
15 changes: 15 additions & 0 deletions domains/adnan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"owner": {
"username": "adnansid99",
"email": "asr3012003@gmail.com"
},

"target": {
"CNAME": {
"name": "adnan",
"value": "adnan.pages.dev"
}
},

"proxied": true
}
15 changes: 15 additions & 0 deletions domains/aj.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"owner": {
"username": "alijafari-gd",
"email": "ali.jafari.sn@gmail.com"
},

"target": {
"CNAME": {
"name": "aj",
"value": "alijafari.is-a.dev"
}
},

"proxied": false
}
13 changes: 13 additions & 0 deletions domains/ajay-charotariya.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"owner": {
"username": "ajay-charotariya",
"email": "ajay-charotariya@acquaintsofttech.com"
},
"target": {
"CNAME": {
"name": "ajay-charotariya",
"value": "ajay-charotariya.github.io"
}
},
"proxied": false
}
Loading

0 comments on commit 3735954

Please sign in to comment.