First commit.

This commit is contained in:
Koen Rouwhorst 2019-01-05 12:24:28 +01:00
parent 3fcaa08453
commit 362c67c1a4
4 changed files with 118 additions and 1 deletions

18
Dockerfile Normal file
View file

@ -0,0 +1,18 @@
FROM stackexchange/dnscontrol:v0.2.8@sha256:007447bf199e74964b854b40585bd3ad1e60c6586fbb5e46c935fe9ffbaeedb3
LABEL repository="https://github.com/koenrh/dnscontrol-action"
LABEL maintainer="Koen Rouwhorst <info@koenrouwhorst.nl>"
LABEL "com.github.actions.name"="DNSControl"
LABEL "com.github.actions.description"="Deploy your DNS configuration to multiple providers."
LABEL "com.github.actions.icon"="cloud"
LABEL "com.github.actions.color"="yellow"
RUN apk add --no-cache \
bash~=4 \
jq~=1.6
COPY README.md /
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

15
LICENSE.txt Normal file
View file

@ -0,0 +1,15 @@
ISC License
Copyright (c) 2018, Koen Rouwhorst
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -1 +1,34 @@
# dnscontrol-action # DNSControl Action
Deploy your DNS configuration using [GitHub Actions](https://github.com/actions)
using [DNSControl](https://github.com/StackExchange/dnscontrol/).
## Supported providers
Not all [providers](https://stackexchange.github.io/dnscontrol/provider-list) are
supported yet.
- [ ] Active Directory PowerShell
- [ ] BIND
- [x] Cloudflare
- [x] DigitalOcean
- [x] DNSimple
- [ ] Gandi
- [ ] Google Cloud DNS
- [ ] HEXONET
- [x] Linode
- [ ] Name.com
- [ ] Namecheap
- [x] NS1
- [ ] OVH
- [x] Route 53
- [ ] SoftLayer DNS
- [ ] Vultr
## Usage
TODO
## Secrets
TODO

51
entrypoint.sh Executable file
View file

@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
# NOTE: DNSControl requires a credentials file on disk. See: https://git.io/fhIb3
echo "{}" > creds.json
add_key () {
# shellcheck disable=SC2094
cat <<< "$(jq "$1 = \"$2\"" < creds.json)" > creds.json
}
if [[ -n "$CLOUDFLARE_API_USER" && -n "$CLOUDFLARE_API_KEY" ]]
then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/cloudflare
add_key ".cloudflare.apiuser" "\$CLOUDFLARE_API_USER"
add_key ".cloudflare.apikey" "\$CLOUDFLARE_API_KEY"
elif [[ -n "$DIGITALOCEAN_OAUTH_TOKEN" ]]
then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/digitalocean
add_key ".digitalocean.token" "\$DIGITALOCEAN_OAUTH_TOKEN"
elif [[ -n "$DNSIMPLE_ACCOUNT_ACCESS_TOKEN" ]]
then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/dnsimple
add_key ".dnsimple.token" "\$DNSIMPLE_ACCOUNT_ACCESS_TOKEN"
elif [[ -n "$LINODE_ACCESS_TOKEN" ]]
then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/linode
add_key ".linode.token" "\$LINODE_ACCESS_TOKEN"
elif [[ -n "$NSONE_API_KEY" ]]
then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/ns1
add_key ".ns1.api_token" "\$NSONE_API_KEY"
elif [[ -n "$AWS_ACCESS_KEY_ID" && -n "$AWS_SECRET_ACCESS_KEY" ]]
then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/route53
add_key ".r53.KeyId" "\$AWS_ACCESS_KEY_ID"
add_key ".r53.SecretKey" "\$AWS_SECRET_ACCESS_KEY"
if [[ -n "$AWS_SESSION_TOKEN" ]]
then
add_key ".r53.Token" "\$AWS_SESSION_TOKEN"
fi
fi
sh -c "dnscontrol $*"