Merge pull request #75 from noclocks/develop #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DNSControl | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'dnsconfig.js' | |
- '.github/workflows/dnscontrol.yml' | |
- 'creds.example.json' | |
workflow_dispatch: | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PORKBUN_API_KEY: ${{ secrets.PORKBUN_API_KEY }} | |
PORKBUN_API_SECRET: ${{ secrets.PORKBUN_API_SECRET }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
CONFIG_FILE: 'dnsconfig.js' | |
CREDS_FILE: 'creds.example.json' | |
jobs: | |
dnscontrol-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check | |
id: dnscontrol_check | |
uses: is-cool-me/[email protected] | |
with: | |
args: check | |
config_file: 'dnsconfig.js' | |
creds_file: 'creds.example.json' | |
dnscontrol-preview: | |
runs-on: ubuntu-latest | |
needs: dnscontrol-check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Preview | |
id: dnscontrol_preview | |
uses: is-cool-me/[email protected] | |
with: | |
args: preview --notify | |
config_file: 'dnsconfig.js' | |
creds_file: 'creds.example.json' | |
dnscontrol-push: | |
runs-on: ubuntu-latest | |
needs: dnscontrol-preview | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Get Date | |
id: get_date | |
run: echo "REPORT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
- name: Get File Name | |
id: get_file_name | |
env: | |
REPORT_DATE: ${{ env.REPORT_DATE }} | |
run: echo "REPORT_FILE=./reports/$REPORT_DATE-Report.txt" >> $GITHUB_ENV | |
- name: Test Echo Date | |
env: | |
REPORT_DATE: ${{ env.REPORT_DATE }} | |
REPORT_FILE: ${{ env.REPORT_FILE }} | |
run: | | |
echo "$REPORT_DATE" | |
echo "$REPORT_FILE" | |
- name: Push | |
id: dnscontrol_push | |
uses: is-cool-me/[email protected] | |
with: | |
args: push --notify --report ${{ env.REPORT_FILE }} | |
config_file: 'dnsconfig.js' | |
creds_file: 'creds.example.json' | |
- name: Git Pull | |
id: git_pull | |
run: git pull | |
- name: Commit and Push Changes | |
id: git_commit_push | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_user_name: 'github-actions[bot]' | |
commit_message: 'chore: github action dnscontrol - $REPORT_DATE' |