Skip to content

mdryden/dryden.dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Deploy

dryden.dev

The source which drives my personal profile site at dryden.dev, and perhaps a good example of how you can generate and deploy a static site built with Hugo using GitHub Actions and Google Cloud Storage.

Configuration

If you were to clone this repository, or to borrow the github actions and adjust to work with your own site, here's what you'd need to do:

  1. Configure your DNS with a CNAME that points to "c.storage.googleapis.com."

I use CloudFlare to host my DNS, because it's easy, free, and deals with HTTPS for me.

  1. Create a bucket in Google Cloud with a name that matches the domain you are using. For example, my bucket name is "dryden.dev".

Note that if you didn't register your domain with Google Domains, you'll need to jump through some hoops to prove you own the domain.

Make sure your bucket is public, and that the "allUsers" principle has the "Cloud Storage > Storage Object Viewer" role.

  1. Navigate to the root of Cloud Storage, click the overflow menu (3 dots) beside your bucket, and go into "Edit Website Configuration". Set the index to "index.html" and the 404 to "404.html".

  2. Create a GCP service account using the "IAM & Admin" panel, and grant it the "Cloud Storage > Storage Admin" and "Cloud Storage > Storage Object Admin" roles.

  3. Create a JSON key for your service account.

  4. Copy the contents of the JSON key file into a GitHub actions secret.

I called mine GCP_SERVICE_ACCOUNT_KEY. You can call your secret whatever you want, but you'll need to update deploy.yml to match.

  1. Update deploy.yml with the correct bucket name.

In theory, that's it. If your DNS is resolving to your bucket, every commit to main which includes changes in the www folder should trigger a redeploy to GCP.

Running locally

If you want to run this site locally, you'll need to have Hugo installed. Once you do, you can run hugo server from the www folder, then navigate to http://localhost:1313 in your browser.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published