diff --git a/.github/workflows/release-production.yml b/.github/workflows/release-production.yml index ede6b4b..1876a60 100644 --- a/.github/workflows/release-production.yml +++ b/.github/workflows/release-production.yml @@ -46,7 +46,7 @@ jobs: args: --follow-symlinks --delete env: SOURCE_DIR: "./dist" - DEST_DIR: "acs-widget" + DEST_DIR: "acs-widget-actions" AWS_REGION: ${{ secrets.AWS_S3_REGION }} AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -58,7 +58,7 @@ jobs: env: DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION }} # TODO: Update only updated files w example: https://github.com/chetan/invalidate-cloudfront-action - PATHS: "/acs-widget/widget.js /acs-widget/index.html /acs-widget/favicon.ico" + PATHS: "/acs-widget-actions/*" AWS_REGION: ${{ secrets.AWS_S3_REGION }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/release-staging.yml b/.github/workflows/release-staging.yml index 5394d2b..87f0134 100644 --- a/.github/workflows/release-staging.yml +++ b/.github/workflows/release-staging.yml @@ -45,7 +45,7 @@ jobs: args: --follow-symlinks --delete env: SOURCE_DIR: "./dist" - DEST_DIR: "acs-widget-staging" + DEST_DIR: "acs-widget-actions-staging" AWS_REGION: ${{ secrets.AWS_S3_REGION }} AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -57,7 +57,7 @@ jobs: env: DISTRIBUTION: ${{ secrets.AWS_CF_DISTRIBUTION }} # TODO: Update only updated files w example: https://github.com/chetan/invalidate-cloudfront-action - PATHS: "/acs-widget-staging/*" + PATHS: "/acs-widget-actions-staging/*" AWS_REGION: ${{ secrets.AWS_S3_REGION }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/AWS_SETUP.md b/AWS_SETUP.md new file mode 100644 index 0000000..1cf58dd --- /dev/null +++ b/AWS_SETUP.md @@ -0,0 +1,66 @@ +# Setup the AWS for distribution + +- S3 will save the files +- Cloudfront will provide HTTPS for sending the files and CDN + +## Setup S3 bucket +- Name: acs-widget-actions + +- Block all public access (bucket settings) + - Block all public access: Off + - Click yellow box - [x] I acknowledge that... + +- Bucket versioning - Disabled +- Tags - None +- Default encryption + +- Bucket policy +```json +{ + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "PublicReadGetObject", + "Effect": "Allow", + "Principal": "*", + "Action": "s3:GetObject", + "Resource": "arn:aws:s3:::acs-widget-actions/*" + } + ] +} +``` +- ACL disabled + +- CORS file +```json +[ + { + "AllowedHeaders": [ + "*" + ], + "AllowedMethods": [ + "GET" + ], + "AllowedOrigins": [ + "*" + ], + "ExposeHeaders": [] + } +] +``` + +- Directories: + - acs-widget-actions-staging + - acs-widget-actions + +### Github Action Secrets setup + - AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY -> in 1Password or create new IAM user with full access to S3 + - AWS_S3_BUCKET, AWS_S3_REGION -> 'acs-widget-actions', 'eu-central-1' + - AWS_CF_DISTRIBUTION -> Is the Cloudfront distribution ID + +### Cloudfront setup + - Create new distribution + - Connect it to our existing bucket as Origin + - Allow HTTP3 and HTTP with HTTPS + - All the rest should stay default + diff --git a/README.md b/README.md index b0e4aba..56df43b 100644 --- a/README.md +++ b/README.md @@ -9,20 +9,20 @@ In order to embed the widget add the following snippet at any location on the ho ```html
- + ... - + ... @@ -50,8 +50,8 @@ You can optionally change CSS class prefix `classPrefix` to provide your CSS sty ## Production builds For production use these URLs: -- `https://TODO.cloudfront.net/acs-widget/widget.js` -- `https://TODO.cloudfront.net/acs-widget/main.css` +- `https://d365a01fpruiwk.cloudfront.net/acs-widget-actions/widget.js` +- `https://d365a01fpruiwk.cloudfront.net/acs-widget-actions/main.css` ## Develop @@ -73,7 +73,7 @@ git tag vX.X.X-beta && git push origin vX.X.X-beta ``` After this wait for the Github Actions to finish the deploy to S3 and Cloudfront. -The demo app will be avail at: https://XXX.cloudfront.net/acs-widget-staging/index.html +The demo app will be avail at: https://d365a01fpruiwk.cloudfront.net/acs-widget-actions-staging/index.html ## Release new version to production @@ -84,7 +84,7 @@ git tag vX.X.X && git push origin vX.X.X ``` After this wait for the Github Actions to finish the deploy to S3 and Cloudfront. -The demo app will be avail at: https://XXX.cloudfront.net/acs-widget/index.html +The demo app will be avail at: https://d365a01fpruiwk.cloudfront.net/acs-widget-actions/index.html ## License The source and documentation in this project are released under the [MIT License](LICENSE) diff --git a/html-dev/index.html b/html-dev/index.html index 489f8f8..b8c4494 100644 --- a/html-dev/index.html +++ b/html-dev/index.html @@ -13,7 +13,7 @@