Skip to content

Commit

Permalink
Merge commit 'daaf009df3a9eb52f136596fb9d5d62b6a323572' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jan 13, 2022
2 parents 2d3a2cf + daaf009 commit fae24ad
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 15 deletions.
63 changes: 52 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,8 @@ jobs:
- name: Install dependencies
run: yarn --frozen-lockfile --cache-folder .yarn

- name: Build runtime
run: yarn workspace @millihq/tf-next-runtime build

- name: Build tf-next
run: yarn workspace tf-next build

- name: Build proxy
run: yarn workspace @millihq/terraform-next-proxy build

- name: Build deploy-trigger
run: yarn workspace @millihq/terraform-next-deploy-trigger build
- name: Build
run: yarn build

- name: Upload build artifacts
uses: actions/upload-artifact@v2
Expand All @@ -48,7 +39,9 @@ jobs:
path: |
packages/runtime/dist/
packages/tf-next/dist/
packages/proxy/dist/
packages/proxy/dist.zip
packages/deploy-trigger/dist/
packages/deploy-trigger/dist.zip
if-no-files-found: error

Expand Down Expand Up @@ -185,3 +178,51 @@ jobs:
cat sam-local.log
printf "\n\nOutput of sam-api.log:\n"
cat sam-api.log
publishRelease:
name: Potentially publish release
runs-on: ubuntu-latest
needs: [build, test-integration, test-e2e]
if: github.ref == 'refs/heads/main'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 25

- name: Fetch git tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'yarn'

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: dist
path: packages

# git user is required (bot not used) by release-it
- name: Set git user to GitHub Actions
uses: fregante/setup-git-user@v1.0.1

- name: Set registry for publish
run: yarn config set registry https://registry.npmjs.org

- name: Publish packages
run: ./scripts/publish-release.sh
continue-on-error: true

- name: Save npm logs
uses: actions/upload-artifact@v2
with:
name: npm-logs
path: /home/runner/.npm/_logs/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ node_modules
.direnv
.envrc

# Turbo
.turbo
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
# Changelog

## 0.10.2 (November 29, 2021)
## [Unreleased]

## [0.11.0] - 2022-01-13

### Added

- Option for attaching a waf policy to the internal CloudFront distribution ([#250](https://github.com/milliHQ/terraform-aws-next-js/pull/250))

### Changed

- TTL for `Cache-Control` header is set to `0` (no cache) when the header is not sent from origin ([#241](https://github.com/milliHQ/terraform-aws-next-js/pull/241), [#236](https://github.com/milliHQ/terraform-aws-next-js/issues/236), [#254](https://github.com/milliHQ/terraform-aws-next-js/pull/254))

### Fixed

- Static routes were falsely generated when running on Windows ([#246](https://github.com/milliHQ/terraform-aws-next-js/issues/246))

## [0.10.2] (November 29, 2021)

Bugfix release that ensures compatibility with the `v12.0.0` version of the [Terraform Next.js Image Optimization module for AWS](https://github.com/milliHQ/terraform-aws-next-js-image-optimization).

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ You can create a `.terraformignore` in the root of your project and add the foll
| cloudfront\_minimum\_protocol\_version | The minimum version of the SSL protocol that you want CloudFront to use for HTTPS connections. One of SSLv3, TLSv1, TLSv1\_2016, TLSv1.1\_2016, TLSv1.2\_2018 or TLSv1.2\_2019. | `string` | `"TLSv1"` | no |
| cloudfront\_origin\_request\_policy | Id of a custom request policy that overrides the default policy (AllViewer). Can be custom or managed. | `string` | `null` | no |
| cloudfront\_price\_class | Price class for the CloudFront distributions (main & proxy config). One of PriceClass\_All, PriceClass\_200, PriceClass\_100. | `string` | `"PriceClass_100"` | no |
| cloudfront\_webacl\_id | An optional webacl2 arn or webacl id to associate with the cloudfront distribution | `string` | `null` | no |
| create\_image\_optimization | Controls whether resources for image optimization support should be created or not. | `bool` | `true` | no |
| debug\_use\_local\_packages | Use locally built packages rather than download them from npm. | `bool` | `false` | no |
| deployment\_name | Identifier for the deployment group (only lowercase alphanumeric characters and hyphens are allowed). | `string` | `"tf-next"` | no |
Expand Down Expand Up @@ -284,6 +285,11 @@ So issues that exist on Vercel are likely to occur on this project too.
Contributions are welcome!
If you want to improve this module, please take a look at our [contributing guidelines](https://github.com/milliHQ/terraform-aws-next-js/tree/main/CONTRIBUTING.md) to get started.

## About

This project is maintained by [milliVolt infrastructure](https://milli.is).
We build custom infrastructure solutions for any cloud provider.

## License

Apache-2.0 - see [LICENSE](./LICENSE) for details.
Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ resource "aws_cloudfront_cache_policy" "this" {

# Default values (Should be provided by origin)
min_ttl = 0
default_ttl = 86400
default_ttl = 0
max_ttl = 31536000

parameters_in_cache_key_and_forwarded_to_origin {
Expand Down Expand Up @@ -393,6 +393,7 @@ module "cloudfront_main" {
cloudfront_aliases = var.cloudfront_aliases
cloudfront_acm_certificate_arn = var.cloudfront_acm_certificate_arn
cloudfront_minimum_protocol_version = var.cloudfront_minimum_protocol_version
cloudfront_webacl_id = var.cloudfront_webacl_id

cloudfront_default_root_object = local.cloudfront_default_root_object
cloudfront_origins = local.cloudfront_origins
Expand Down
1 change: 1 addition & 0 deletions modules/cloudfront-main/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ resource "aws_cloudfront_distribution" "distribution" {
price_class = var.cloudfront_price_class
aliases = var.cloudfront_aliases
default_root_object = var.cloudfront_default_root_object
web_acl_id = var.cloudfront_webacl_id

# Add CloudFront origins
dynamic "origin" {
Expand Down
6 changes: 6 additions & 0 deletions modules/cloudfront-main/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ variable "cloudfront_custom_error_response" {
default = null
}

variable "cloudfront_webacl_id" {
description = "An optional webacl2 arn or webacl id to associate with the cloudfront distribution"
type = string
default = null
}

##########
# Labeling
##########
Expand Down
2 changes: 1 addition & 1 deletion modules/proxy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

variable "proxy_module_version" {
type = string
default = "0.10.2"
default = "0.11.0"
}

variable "lambda_default_runtime" {
Expand Down
2 changes: 1 addition & 1 deletion modules/statics-deploy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ variable "static_files_archive" {

variable "deploy_trigger_module_version" {
type = string
default = "0.10.2"
default = "0.11.0"
}

variable "expire_static_assets" {
Expand Down
26 changes: 26 additions & 0 deletions scripts/publish-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

#!/bin/bash

git describe --exact-match

if [[ ! $? -eq 0 ]];then
echo "Nothing to publish, exiting.."
exit 0;
fi

if [[ -z "$NPM_TOKEN" ]];then
echo "No NPM_TOKEN, exiting.."
exit 0;
fi

echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc

if [[ $(git describe --exact-match 2> /dev/null || :) =~ "packages-v" ]];then
echo "Publishing version"
yarn release:ci

# Make sure to exit script with code 1 if publish failed
if [[ ! $? -eq 0 ]];then
exit 1;
fi
fi
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ variable "cloudfront_external_arn" {
default = null
}

variable "cloudfront_webacl_id" {
description = "An optional webacl2 arn or webacl id to associate with the cloudfront distribution"
type = string
default = null
}

##########
# Labeling
##########
Expand Down

0 comments on commit fae24ad

Please sign in to comment.