This repository contains a GitHub Action allowing you to deploy assets, such as a static site, to an AWS S3 bucket.
It is also expected that the relevant bucket is behind a Cloudfront Distribution, against which the Action creates an Invalidation after successful deployment.
Add the following step to a GitHub Actions workflow.
- name: ๐ Deploy
uses: perxhealth/static-deploy-action@v1
with:
from: dist/
to: s3://your-s3-bucket-uri
cloudfront-distribution-id: KJPAKNWQ4OR54The Action currently expects three required inputs, and no further optional inputs.
-
fromPath to a directory on local disk in which all files within will be uploaded, overwriting files in the S3 bucket with the same name.
-
toFully qualified S3 remote path. Must start with
s3://. -
cloudfront-distribution-idUpon successful upload of the files nominated in
from, this is the Cloudfront Distribution on which we'll create anInvalidation.
The Action currently produces no outputs.
The Action currently expects AWS credentials to exist in the environment, with sufficient permissions to perform the following actions.
ListObjectsPutObjectDeleteObject
CreateInvalidation
Follow the below steps to get up and running with a local, development copy of the Action.
You will need the following tools installed on your machine.
$ git clone git@github.com:perxhealth/static-deploy-action
$ cd static-deploy-actionFirstly, you'll want to ensure the correct versions of the necessary system dependencies are installed.
$ asdf installNote: optionally, you may need to install the necessary asdf plugins first.
$ asdf plugin add nodejs
$ asdf plugin add pnpmLastly, go ahead and install the Action's dependencies via pnpm
$ pnpm installThere's no server to run, or any particular commands to be aware of during active development. The best way to make sure your changes behave as intended is to write unit tests.
The repositories maintainers will take care of packaging and releasing new versions after Pull Requests have been merged. Although, we plan to automate this in future if there's enough demand.
Ensure you write tests to cover any code or behaviour you introduce. The test suite can be run with the following command...
$ pnpm test