Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

provision-dns:

env:
GODADDY_API_KEY: ${{ secrets.GODADDY_API_KEY }}
GODADDY_API_SECRET: ${{ secrets.GODADDY_API_SECRET }}

defaults:
run:
working-directory: infra # start in the infrastructure directory, rather than root

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: fregante/setup-git-user@v1 # sets the user.name and user.email gitconfig

- uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

- run: |
bash <(curl -s https://raw.githubusercontent.com/n3integration/terraform-godaddy/master/install.sh)
cat > ~/.terraformrc <<EOF
providers {
godaddy = "$HOME/.terraform/plugins/terraform-godaddy"
}
EOF
ls -la

- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true

- name: Terraform Init
id: init
run: terraform init

- name: Terraform Validate
id: validate
run: terraform validate -no-color

- name: Terraform Plan
id: plan
run: terraform plan -no-color
continue-on-error: true

- name: Terraform Apply
id: apply
run: terraform apply -no-color

build:

needs: [provision-dns]

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run build --if-present
- run: npm run export
- run: npm run deploy
30 changes: 0 additions & 30 deletions .github/workflows/node.js.yml

This file was deleted.

29 changes: 29 additions & 0 deletions infra/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
provider "godaddy" {}


resource "godaddy_domain_record" "gd-fancy-domain" {
domain = "mcnulty.xyz"

// specify zero or more record blocks
// a record block allows you to configure A, or NS records with a custom time-to-live value
// a record block also allow you to configure AAAA, CNAME, TXT, or MX records
record {
name = "www"
type = "CNAME"
data = "mcnultyyy.github.io"
ttl = 3600
}

// specify any A records associated with the domain
// GitHub IPs as per https://docs.github.com/en/free-pro-team@latest/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site#configuring-an-apex-domain
addresses = [
"185.199.108.153",
"185.199.109.153",
"185.199.110.153",
"185.199.111.153"
]

// specify any custom nameservers for your domain
// note: godaddy now requires that the 'custom' nameservers are first supplied through the ui
nameservers = ["ns75.domains.com", "ns76.domains.com"]
}
41 changes: 41 additions & 0 deletions posts/godaddy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Setting up a custom domain name using GitHub pages

## Prerequisites

- GitHub account
- GoDaddy account + domain
- Terraform account

## Create GoDaddy API key

The following environment variables/github secrets need to be setup

Create a new API key from
https://developer.godaddy.com/keys/

Set the following repository secrets at https://github.com/McNultyyy/mcnultyyy.github.io/settings/secrets/actions
`GODADDY_API_KEY`
`GODADDY_API_SECRET`

## Create the Terraform API key

Create a new API key
https://app.terraform.io/app/mcnulty/settings/authentication-tokens

And set it up a repository secret with the key as `TF_API_TOKEN`

## Setting up the www domain

Create a new file in the root of your github project called "CNAME"
The contents of this file should be the (sub)domain that you want to use (www.mcnulty.xyz)

Create a DNS entry in your provider with the following mapping

| Type | Name | Value |
| ----- | ---- | ------------------- |
| CNAME | www | mcnultyyy.github.io |


A quick note on DNS entries:
`A` entries map from a name to an IP
`CNAME` entries map from a name to another name