Merge pull request #16 from koenrh/koenrh/add-github-actions-metadata-file

Add GitHub Actions metadata file
This commit is contained in:
Koen Rouwhorst 2019-10-12 18:41:50 +02:00 committed by GitHub
commit 7cf2a73691
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 155 additions and 13 deletions

View file

@ -14,11 +14,9 @@ jobs:
args: Dockerfile args: Dockerfile
- name: Bats - name: Bats
uses: actions/bin/bats@master uses: koenrh/actions/bats@master
with: with:
args: test/*.bats args: test/*.bats
- name: ShellCheck - name: ShellCheck
uses: actions/bin/shellcheck@master run: shellcheck entrypoint.sh
with:
args: entrypoint.sh

101
action.yml Normal file
View file

@ -0,0 +1,101 @@
---
name: DNSControl Action
description: Deploy your DNS configuration to multiple providers
author: Koen Rouwhorst <info@koenrouwhorst.nl>
branding:
icon: cloud
color: yellow
inputs:
cloudflareApiUser:
description: Cloudflare API user
required: false
cloudflareApiKey:
description: Cloudflare API key
required: false
cloudflareAccountId:
description: Cloudflare account identifier
required: false
cloudflareAccountName:
description: Cloudflare account name
required: false
digitalOceanOAuthToken:
description: Digital Ocean OAuth token
required: false
dnsimpleAccountAccessToken:
description: DNSimple account access token
required: false
gandiApiKey:
description: Gandi API key
required: false
googleCloudDNSProjectId:
description: Google Cloud DNS project identifier
required: false
googleCloudDNSPrivateKeyId:
description: Google Cloud DNS private key identifier
required: false
googleCloudDNSPrivateKey:
description: Google Cloud DNS private key
required: false
googleCloudDNSClientEmail:
description: Google Cloud DNS client email
required: false
googleCloudDNSClientID:
description: Google Cloud DNS client identifier
required: false
googleCloudDNSClientX509CertUrl:
description: Google Cloud DNS client X.509 certificate URL
required: false
linodeAccessToken:
description: Linode access token
required: false
nameComApiUser:
description: Name.com API user
required: false
nameComApiKey:
required: false
description: Name.com API key
nameComApiUrl:
required: false
description: Name.com API URL
namecheapApiUser:
description: Namecheap API user
required: false
namecheapApiKey:
description: Namecheap API key
required: false
namecheapBaseUrl:
description: Namecheap base URL
required: false
nsOneApiKey:
description: NS1 API key
required: false
ovhAppKey:
description: OVH app key
required: false
ovhAppSecretKey:
description: OVH app secret key
required: false
ovhConsumerKey:
description: OVH consumer key
required: false
awsAccessKeyId:
description: AWS access key identifier
required: false
awsSecretAccessKey:
description: AWS secret access key
required: false
awsSessionToken:
description: AWS session token
required: false
softLayerUsername:
description: SoftLayer username
required: false
softLayerApiKey:
description: SoftLayer API key
required: false
vultrToken:
description: Vultr token
required: false
runs:
using: docker
image: 'Dockerfile'

View file

@ -10,6 +10,49 @@ add_key () {
cat <<< "$(jq "$1 = \"$2\"" < creds.json)" > creds.json cat <<< "$(jq "$1 = \"$2\"" < creds.json)" > creds.json
} }
CLOUDFLARE_API_USER="${INPUT_CLOUDFLAREAPIUSER:-$CLOUDFLARE_API_USER}"
CLOUDFLARE_API_KEY="${INPUT_CLOUDFLAREAPIKEY:-$CLOUDFLARE_API_KEY}"
CLOUDFLARE_ACCOUNT_ID="${INPUT_CLOUDFLAREACCOUNTID:-$CLOUDFLARE_ACCOUNT_ID}"
CLOUDFLARE_ACCOUNT_NAME="${INPUT_CLOUDFLAREACCOUNTNAME:-$CLOUDFLARE_ACCOUNT_NAME}"
DIGITALOCEAN_OAUTH_TOKEN="${INPUT_DIGITALOCEANOAUTHTOKEN:-$DIGITALOCEAN_OAUTH_TOKEN}"
DNSIMPLE_ACCOUNT_ACCESS_TOKEN="${INPUT_DNSIMPLEACCOUNTACCESSTOKEN:-$DNSIMPLE_ACCOUNT_ACCESS_TOKEN}"
GANDI_API_KEY="${INPUT_GANDIAPIKEY:-$GANDI_API_KEY}"
GOOGLE_CLOUD_PROJECT_ID="${INPUT_GOOGLECLOUDPROJECTID:-$GOOGLE_CLOUD_PROJECT_ID}"
GOOGLE_CLOUD_PRIVATE_KEY_ID="${INPUT_GOOGLECLOUDPRIVATEKEYID:-$GOOGLE_CLOUD_PRIVATE_KEY_ID}"
GOOGLE_CLOUD_PRIVATE_KEY="${INPUT_GOOGLECLOUDPRIVATEKEY:-$GOOGLE_CLOUD_PRIVATE_KEY}"
GOOGLE_CLOUD_CLIENT_EMAIL="${INPUT_GOOGLECLOUDCLIENTEMAIL:-$GOOGLE_CLOUD_CLIENT_EMAIL}"
GOOGLE_CLOUD_CLIENT_ID="${INPUT_GOOGLECLOUDCLIENTID:-$GOOGLE_CLOUD_CLIENT_ID}"
GOOGLE_CLOUD_CLIENT_X509_CERT_URL="${INPUT_GOOGLECLOUDCLIENTX509CERTURL:-$GOOGLE_CLOUD_CLIENT_X509_CERT_URL}"
LINODE_ACCESS_TOKEN="${INPUT_LINODEACCESSTOKEN:-$LINODE_ACCESS_TOKEN}"
NAME_COM_API_USER="${INPUT_NAMECOMAPIUSER:-$NAME_COM_API_USER}"
NAME_COM_API_KEY="${INPUT_NAMECOMAPIKEY:-$NAME_COM_API_KEY}"
NAME_COM_API_URL="${INPUT_NAMECOMAPIURL:-$NAME_COM_API_URL}"
NAMECHEAP_API_USER="${INPUT_NAMECOMAPIUSER:-$NAME_COM_API_USER}"
NAMECHEAP_API_KEY="${INPUT_NAMECOMAPIKEY:-$NAME_COM_API_KEY}"
NAMECHEAP_BASE_URL="${INPUT_NAMECOMBASEURL:-$NAME_COM_BASE_URL}"
NSONE_API_KEY="${INPUT_NSONEAPIKEY:-$NSONE_API_KEY}"
OVH_APP_KEY="${INPUT_OVHAPPKEY:-$OVH_APP_KEY}"
OVH_APP_SECRET_KEY="${INPUT_OVHAPPSECRETKEY:-$OVH_APP_SECRET_KEY}"
OVH_CONSUMER_KEY="${INPUT_OVHCONSUMERKEY:-$OVH_CONSUMER_KEY}"
AWS_ACCESS_KEY_ID="${INPUT_AWSACCESSKEYID:-$AWS_ACCESS_KEY_ID}"
AWS_SECRET_ACCESS_KEY="${INPUT_AWSSECRETACCESSKEYID:-$AWS_SECRET_ACCESS_KEY}"
AWS_SESSION_TOKEN="${INPUT_AWSSESSIONTOKEN:-$AWS_SESSION_TOKEN}"
SOFTLAYER_USERNAME="${INPUT_SOFTLAYERUSERNAME:-$SOFTLAYER_USERNAME}"
SOFTLAYER_API_KEY="${INPUT_SOFTLAYERAPIKEY:-$SOFTLAYER_API_KEY}"
VULTR_TOKEN="${INPUT_VULTRTOKEN:-$VULTR_TOKEN}"
if [[ -n "$CLOUDFLARE_API_USER" && -n "$CLOUDFLARE_API_KEY" ]] if [[ -n "$CLOUDFLARE_API_USER" && -n "$CLOUDFLARE_API_KEY" ]]
then then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/cloudflare # NOTE: https://stackexchange.github.io/dnscontrol/providers/cloudflare
@ -47,15 +90,15 @@ if [[ -n "$GOOGLE_CLOUD_PROJECT_ID" && -n "$GOOGLE_CLOUD_PRIVATE_KEY_ID"
then then
# NOTE: https://stackexchange.github.io/dnscontrol/providers/gcloud # NOTE: https://stackexchange.github.io/dnscontrol/providers/gcloud
add_key ".gcloud.type" "service_account" add_key ".gcloud.type" "service_account"
add_key "gcloud.project_id": "\$GOOGLE_CLOUD_PROJECT_ID", add_key ".gcloud.project_id": "\$GOOGLE_CLOUD_PROJECT_ID",
add_key "gcloud.private_key_id": "\$GOOGLE_CLOUD_PRIVATE_KEY_ID", add_key ".gcloud.private_key_id": "\$GOOGLE_CLOUD_PRIVATE_KEY_ID",
add_key "gcloud.private_key": "\$GOOGLE_CLOUD_PRIVATE_KEY", add_key ".gcloud.private_key": "\$GOOGLE_CLOUD_PRIVATE_KEY",
add_key "gcloud.client_email": "\$GOOGLE_CLOUD_CLIENT_EMAIL", add_key ".gcloud.client_email": "\$GOOGLE_CLOUD_CLIENT_EMAIL",
add_key "gcloud.client_id": "\$GOOGLE_CLOUD_CLIENT_ID", add_key ".gcloud.client_id": "\$GOOGLE_CLOUD_CLIENT_ID",
add_key "gcloud.auth_uri": "https://accounts.google.com/o/oauth2/auth", add_key ".gcloud.auth_uri": "https://accounts.google.com/o/oauth2/auth",
add_key "gcloud.token_uri": "https://accounts.google.com/o/oauth2/token", add_key ".gcloud.token_uri": "https://accounts.google.com/o/oauth2/token",
add_key "gcloud.auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", add_key ".gcloud.auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
add_key "gcloud.client_x509_cert_url": "\$GOOGLE_CLOUD_CLIENT_X509_CERT_URL" add_key ".gcloud.client_x509_cert_url": "\$GOOGLE_CLOUD_CLIENT_X509_CERT_URL"
fi fi
if [[ -n "$LINODE_ACCESS_TOKEN" ]] if [[ -n "$LINODE_ACCESS_TOKEN" ]]