This action runs octodns-sync
from octodns/octodns to deploy your DNS config to any cloud.
octodns allows you to manage your DNS records in a portable format and publish changes across different DNS providers. It is extensible and customizable.
When you manage your octodns DNS configuration in a GitHub repository, this GitHub Action allows you to test and publish your changes automatically using a workflow you define.
name: octodns-sync
on:
# Deploy config whenever DNS changes are pushed to main.
push:
branches:
- main
paths:
- '*.yaml'
jobs:
publish:
name: Publish DNS config from main
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- run: pip install -r requirements.txt
- uses: solvaholic/octodns-sync@main
with:
config_path: public.yaml
doit: '--doit'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.route53_aws_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.route53_aws_secret_access_key }}
To authenticate with your DNS provider, this action uses encrypted secrets you've configured on your repository. For example, if you use Amazon Route53, create these secrets on the repository where you store your DNS configuration:
"route53-aws-key-id": "YOURIDGOESHERE"
"route53-aws-secret-access-key": "YOURKEYGOESHERE"
Then include them as environment variables in your workflow. For example:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.route53-aws-key-id }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.route53-aws-secret-access-key }}
Path, relative to your repository root, of the config file you would like octodns to use.
Default "public.yaml"
.
Really do it? Set "--doit" to do it; Any other string to not do it.
Default ""
(empty string).
Run octodns-sync in force mode? Set "Yes" to do it.
Default "No"
.
Add plan as a comment, when triggered by a pull request? Set "Yes" to do it.
Default "No"
.
If you would like to add the plan octodns-sync
generates as a pull request comment, be sure to also read Add pull request comment below.
Provide a token to use, if you set add_pr_comment
to "Yes".
Default "Not set"
.
Space separated list of zones to sync, leave empty to sync all zones in the config file.
Default: ""
(empty string)
If you have configured plan_outputs
for octodns, PlanHtml or PlanMarkdown output will be written to $GITHUB_WORKSPACE/octodns-sync.plan
.
For convenience, this file is output by this action as the plan
output so you may use it in subsequent steps.
octodns-sync
does not write its output to the workflow run log. Its output will be written to $GITHUB_WORKSPACE/octodns-sync.log
.
For convenience, this file is output by this action as the log
output so you may use it in subsequent steps.
If you would like this action to add the octodns-sync
plan to a pull request comment, configure plan_outputs
in your octodns configuration, for example public.yml
:
manager:
plan_outputs:
html:
class: octodns.provider.plan.PlanHtml
Then configure your workflow to run this action on the pull_request
event, set add_pr_comment
to "Yes", and provide an API token. For example:
on:
pull_request:
jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- run: pip install -r requirements.txt
- uses: solvaholic/octodns-sync@main
with:
config_path: public.yaml
add_pr_comment: 'Yes'
pr_comment_token: '${{ github.token }}'
Please note: This configuration will add a new comment to the pull request each time it's triggered. To find out how to change that, check out issue #41 and docs/add_pr_comment.md.