feat(ci): move to dnscontrol

This commit is contained in:
William Harrison
2024-10-19 14:02:50 +08:00
parent b84a12b074
commit 1e866e01e3
29 changed files with 143 additions and 445 deletions
+2 -2
View File
@@ -2,5 +2,5 @@
/sub-logs/* @is-a-good-dev/helpers
/.github/* @Tweak4141
/scripts/* @Tweak4141
/utils/* @Tweak4141
/.github/workflows/* @Tweak4141 @wdhdev
/dnsconfig.js @Tweak4141 @wdhdev
+32
View File
@@ -0,0 +1,32 @@
name: Publish
on:
push:
branches: [main]
paths:
- "sub-logs/*"
- ".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
View File
@@ -1,33 +0,0 @@
name: Update Records
on:
push:
branches: [main]
jobs:
validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Get Files
id: changed-files
uses: tj-actions/changed-files@v34
with:
files: |
sub-logs/**
reserved/**
- name: Install Modules
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn
- name: Publish Records
if: steps.changed-files.outputs.any_changed == 'true'
id: tests
run: yarn add-records
env:
API_KEY: ${{ secrets.API_KEY }}
FILES: ${{ steps.changed-files.outputs.all_changed_files }}
actions_path: ${{ github.workspace }}
+42
View File
@@ -0,0 +1,42 @@
name: Validation
on:
pull_request:
push:
branches: [main]
paths:
- "sub-logs/*"
- ".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
View File
@@ -1,45 +0,0 @@
name: Validation
on: [pull_request]
jobs:
validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Files
id: changed-files
uses: tj-actions/changed-files@v34
with:
files: |
sub-logs/**
reserved/**
- name: Install Modules
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn
- name: Run Tests
if: steps.changed-files.outputs.any_changed == 'true'
id: tests
run: yarn test
env:
FILES: ${{ steps.changed-files.outputs.all_changed_files }}
actions_path: ${{ github.workspace }}
- name: Comment
if: steps.tests.outputs.shouldComment == 'true'
uses: mshick/add-pr-comment@v1
with:
message: |
## Validation Results
| Information Validation | Record Validation |
|-|-|
| ${{steps.tests.outputs.infoMessage}} ${{steps.tests.outputs.infoReason}} | ${{steps.tests.outputs.recordMessage}} ${{steps.tests.outputs.recordInfo}} |
### JSON File Content
```json
${{steps.tests.outputs.jsonData}}
```
repo-token: ${{ secrets.GITHUB_TOKEN }}
proxy-url: https://is-a-good-dev-gh-proxy.talosbot.xyz/
repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens
allow-repeats: false # Default: false