How To Use GitHub Actions To Deploy an 11ty Website To S3

11 February 2021

I use 11ty to generate a static website and S3 to host it. This post describes how I set up a workflow in GitHub Actions to build and deploy the website. The workflow uses the AWS - CLI S3 - sync command to transfer the files.

This post describes how to:

  • create an AWS policy with only those permission needed by the sync command
  • create an AWS individual IAM user with the above policy
  • create a GitHub Action workflow using the sync command to upload the files

I will provide the policy and workflow files first for those wanting only the code. A detailed walkthrough is provided below these files. This post assumes you already have set up an S3 bucket. If not, please see the Hosting a static website using Amazon S3 guide.

Read More...

TIL: Python has an assertLogs function for unit testing log statements

06 January 2021

Today I learned how to unit test log statements with Python. I updated @bcdevexbot to check the status of an opportunity. The bot logs an error message if it encounters an unknown status. To test this scenario I used the assertLogs function.

Read More...

Switching to Utterances For Comments

06 January 2021

I removed disqus as the comments provider on my website because I do not like its privacy policy. I’m trying utterances as the comment provider now. From the website, it’s: A lightweight comments widget built on GitHub issues. Use GitHub issues for blog comments, wiki pages and more!

Read More...

Autoscaling PDF Images On Apple watchOS

25 November 2020

In this post, I will discuss autoscaling PDF images and how to add one to a watchOS project.

The PDF format allows an image to scale without looking fuzzy at different sizes. This format is best used with vector artwork; think icons. Programs like Inkscape, Adobe Illustrator and, Vectornator can export PDF images.

For more details on designing a PDF image see the Image Optimization page in the Human Interface Guidelines for watchOS. It includes the scales used for the different screen sizes.

Setting certain flags in XCode will tell WatchKit to scale the image based on screen size. And so, you have an autoscaling PDF image. This means the project only needs one image for all screen sizes. Otherwise, the project would need multiple scaled image files.

Read More...

How I replaced a nested for loop with flatMap

04 November 2020

This is a short post about how I refactored a nested for loop using flatMap. I had a struct that defined name and quantity properties as shown below:

struct Item {
  let name: String
  let quantity: Int
}

The actual code used a custom type rather than a String, but I’ve used String here to simplify the example.

Read More...

SwiftUI: Previewing localized text in the canvas

29 June 2020

Last week I watched the Swift packages: Resources and localization video from WWDC20. One thing I learned was that the Canvas can preview localized values. This is done by adding a locale to a View via the environment.

Read More...

How I debugged a crashing watchOS app with crash reports and log files

08 May 2020

In a previous blog post, I wrote about my app crashing when it was installed via TestFlight. In this blog post, I will go into more detail about how I debugged the problem using logs and crash reports.

Read More...

Rejection, Acceptance, And Crashes. My TestFlight Journey

03 May 2020

I hit a small milestone recently, I submitted my first app to TestFlight. I thought this process would be quick. Maybe a day or two. A week later I finally had a working app on TestFlight. During that time I learned much about crash logs and debugging. Here is my story.

Read More...

Specify XCode version for GitHub workflows

16 April 2020

I wrote a unit test that used the XCTUnwrap function. This feature was added in XCode 11 and

“Asserts that an expression is not nil and returns the unwrapped value.”

However, when I pushed my code to GitHub, the build broke with the following error.

error: use of unresolved identifier ‘XCTUnwrap’

Read More...

iOS Constraint Issues

05 August 2019

This post is about a problem I had with a UISearchController in an iOS app. The issue was the search bar would animate on top of the status bar. This made it hard to use as shown in the following video.

Read More...