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: KJPAKNWQ4OR54
The Action currently expects three required inputs, and no further optional inputs.
-
from
Path to a directory on local disk in which all files within will be uploaded, overwriting files in the S3 bucket with the same name.
-
to
Fully qualified S3 remote path. Must start with
s3://
. -
cloudfront-distribution-id
Upon 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.
ListObjects
PutObject
DeleteObject
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 [email protected]:perxhealth/static-deploy-action
$ cd static-deploy-action
Firstly, you'll want to ensure the correct versions of the necessary system dependencies are installed.
$ asdf install
Note: optionally, you may need to install the necessary asdf plugins first.
$ asdf plugin add nodejs
$ asdf plugin add pnpm
Lastly, go ahead and install the Action's dependencies via pnpm
$ pnpm install
There'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