diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..bb6573f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: [master] + workflow_dispatch: + +concurrency: + group: release + cancel-in-progress: false + +permissions: + contents: read + +env: + NODE_VERSION: '24' + SEMANTIC_RELEASE_VERSION: '25.0.9' + +# Every push to master: semantic-release reads the commits since the last version tag (each one a +# squash-merged pull request's title) and, when one calls for it, tags the next version and publishes +# its GitHub release with notes. fix: makes a patch, feat: a minor, feat!: (or a BREAKING CHANGE: +# footer) a major; chore, ci, docs, refactor and test release nothing. Nothing is committed back. +jobs: + release: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: write + issues: write + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v7 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Release + run: npx --yes "semantic-release@${SEMANTIC_RELEASE_VERSION}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..754e980 --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,17 @@ +{ + "branches": [ + "master" + ], + "tagFormat": "v${version}", + "plugins": [ + "@semantic-release/commit-analyzer", + "@semantic-release/release-notes-generator", + [ + "@semantic-release/github", + { + "successCommentCondition": false, + "failCommentCondition": false + } + ] + ] +} diff --git a/README.md b/README.md index c55db8d..442ba6f 100644 --- a/README.md +++ b/README.md @@ -1 +1,26 @@ -# aws-tf-modules \ No newline at end of file +# aws-tf-modules + +Terraform modules for AWS, one per folder. Each folder's README shows how to use it. + +## Versions + +A project pins a released version in the module's `source`: + +```hcl +module "static_site" { + source = "github.com/script47/aws-tf-modules//static-site?ref=v1.26.0" +} +``` + +A project changes only when it moves to a new version. + +Releases are automatic. Each pull request is squash-merged, and its title, written as a [conventional commit](https://www.conventionalcommits.org), decides the next version: + +| Title starts with | Version | +|---|---| +| `fix:` | patch (x.y.**z**) | +| `feat:` | minor (x.**y**.0) | +| `feat!:` | major (**x**.0.0), for a change that projects must adapt to | +| `chore:`, `ci:`, `docs:`, `refactor:`, `test:` | no release | + +On the merge, the Release workflow tags the version and publishes its GitHub release, whose notes list the changes. diff --git a/static-site/README.md b/static-site/README.md index 553514f..69c46b5 100644 --- a/static-site/README.md +++ b/static-site/README.md @@ -7,6 +7,7 @@ This module allows you to setup a static site with the following features: - Automatic DNS validation for ACM via Route 53 - Optional creation of Route 53 Hosted Zone (or reuse an existing one) - Multi-domain support + - Automatic gzip compression of text files (JS, CSS, HTML, JSON, SVG) - Fallback support for SPA (`403 → 200 /index.html` and `404 → 200 /index.html`) - Resource tagging for manageable resources diff --git a/static-site/cloudfront.tf b/static-site/cloudfront.tf index 8030fde..0d9fe03 100644 --- a/static-site/cloudfront.tf +++ b/static-site/cloudfront.tf @@ -54,6 +54,9 @@ resource "aws_cloudfront_distribution" "this" { } viewer_protocol_policy = "redirect-to-https" + + # Gzip only: Brotli needs a cache policy in place of forwarded_values. + compress = true } custom_error_response {