Commit 57ba0ef0 authored by Bryant Biggs's avatar Bryant Biggs Committed by GitHub

fix: update CI/CD process to enable auto-release workflow (#711)

parent 89a916e8
# Change Log
All notable changes to this project will be documented in this file.
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]
{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Unreleased.Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}
{{ end -}}
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ if .CommitGroups -}}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}
{{ else }}
{{ range .Commits -}}
{{/* SKIPPING RULES - START */ -}}
{{- if not (hasPrefix .Subject "Updated CHANGELOG") -}}
{{- if not (contains .Subject "[ci skip]") -}}
{{- if not (contains .Subject "[skip ci]") -}}
{{- if not (hasPrefix .Subject "Merge pull request ") -}}
{{- if not (hasPrefix .Subject "Added CHANGELOG") -}}
{{- /* SKIPPING RULES - END */ -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{/* SKIPPING RULES - START */ -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{/* SKIPPING RULES - END */ -}}
{{ end }}
{{ end -}}
{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/terraform-aws-modules/terraform-aws-vpc
options:
header:
pattern: "^(.*)$"
pattern_maps:
- Subject
...@@ -2,98 +2,77 @@ name: Pre-Commit ...@@ -2,98 +2,77 @@ name: Pre-Commit
on: on:
pull_request: pull_request:
push:
branches: branches:
- main
- master - master
env:
TERRAFORM_DOCS_VERSION: v0.16.0
jobs: jobs:
# Min Terraform version(s) collectInputs:
getDirectories: name: Collect workflow inputs
name: Get root directories
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
directories: ${{ steps.dirs.outputs.directories }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2 - name: Get root directories
- name: Build matrix id: dirs
id: matrix uses: clowdhaus/terraform-composite-actions/directories@v1.3.0
run: |
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))")
echo "::set-output name=directories::$DIRS"
outputs:
directories: ${{ steps.matrix.outputs.directories }}
preCommitMinVersions: preCommitMinVersions:
name: Min TF validate name: Min TF pre-commit
needs: getDirectories needs: collectInputs
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
directory: ${{ fromJson(needs.getDirectories.outputs.directories) }} directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
- name: Terraform min/max versions - name: Terraform min/max versions
id: minMax id: minMax
uses: clowdhaus/terraform-min-max@v1.0.2 uses: clowdhaus/terraform-min-max@v1.0.3
with: with:
directory: ${{ matrix.directory }} directory: ${{ matrix.directory }}
- name: Install Terraform v${{ steps.minMax.outputs.minVersion }}
uses: hashicorp/setup-terraform@v1 - name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
with:
terraform_version: ${{ steps.minMax.outputs.minVersion }}
- name: Install pre-commit dependencies
run: pip install pre-commit
- name: Execute pre-commit
# Run only validate pre-commit check on min version supported # Run only validate pre-commit check on min version supported
if: ${{ matrix.directory != '.' }} if: ${{ matrix.directory != '.' }}
run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/* uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0
- name: Execute pre-commit with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
# Run only validate pre-commit check on min version supported # Run only validate pre-commit check on min version supported
if: ${{ matrix.directory == '.' }} if: ${{ matrix.directory == '.' }}
run: pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf) uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0
with:
terraform-version: ${{ steps.minMax.outputs.minVersion }}
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'
# Max Terraform version preCommitMaxVersion:
getBaseVersion: name: Max TF pre-commit
name: Module max TF version
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: collectInputs
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Terraform min/max versions - name: Terraform min/max versions
id: minMax id: minMax
uses: clowdhaus/terraform-min-max@v1.0.2 uses: clowdhaus/terraform-min-max@v1.0.3
outputs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
preCommitMaxVersion: - name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
name: Max TF pre-commit uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0
runs-on: ubuntu-latest
needs: getBaseVersion
strategy:
fail-fast: false
matrix:
version:
- ${{ needs.getBaseVersion.outputs.maxVersion }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
- name: Install Terraform v${{ matrix.version }}
uses: hashicorp/setup-terraform@v1
with: with:
terraform_version: ${{ matrix.version }} terraform-version: ${{ steps.minMax.outputs.maxVersion }}
- name: Install pre-commit dependencies terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}
run: |
pip install pre-commit
curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.13.0/terraform-docs-v0.13.0-$(uname)-amd64.tar.gz && tar -xzf terraform-docs.tar.gz terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
- name: Execute pre-commit
# Run all pre-commit checks on max version supported
if: ${{ matrix.version == needs.getBaseVersion.outputs.maxVersion }}
run: pre-commit run --color=always --show-diff-on-failure --all-files
name: Release
on:
workflow_dispatch:
push:
branches:
- main
- master
paths:
- '**/*.py'
- '**/*.tf'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 18.0.0
extra_plugins: |
@semantic-release/changelog@6.0.0
@semantic-release/git@10.0.0
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
repos: repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform - repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.51.0 rev: v1.58.0
hooks: hooks:
- id: terraform_fmt - id: terraform_fmt
- id: terraform_validate - id: terraform_validate
- id: terraform_docs - id: terraform_docs
args:
- '--args=--lockfile=false'
- id: terraform_tflint - id: terraform_tflint
args: args:
- '--args=--only=terraform_deprecated_interpolation' - '--args=--only=terraform_deprecated_interpolation'
...@@ -20,7 +22,7 @@ repos: ...@@ -20,7 +22,7 @@ repos:
- '--args=--only=terraform_required_providers' - '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure' - '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote' - '--args=--only=terraform_workspace_remote'
- repo: git://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1 rev: v4.0.1
hooks: hooks:
- id: check-merge-conflict - id: check-merge-conflict
{
"branches": [
"main",
"master"
],
"ci": false,
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/github",
{
"successComment":
"This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:",
"labels": false,
"releasedLabels": false
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md",
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file."
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
],
"message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
# Change Log
All notable changes to this project will be documented in this file.
<a name="unreleased"></a>
## [Unreleased]
<a name="v3.11.0"></a> <a name="v3.11.0"></a>
## [v3.11.0] - 2021-11-04 ## [v3.11.0] - 2021-11-04
......
.PHONY: changelog release
changelog:
git-chglog -o CHANGELOG.md --next-tag `semtag final -s minor -o`
release:
semtag final -s minor
...@@ -34,9 +34,9 @@ Note that this example may create resources which can cost money (AWS Elastic IP ...@@ -34,9 +34,9 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | n/a |
| <a name="module_vpc_endpoints"></a> [vpc\_endpoints](#module\_vpc\_endpoints) | ../../modules/vpc-endpoints | | | <a name="module_vpc_endpoints"></a> [vpc\_endpoints](#module\_vpc\_endpoints) | ../../modules/vpc-endpoints | n/a |
| <a name="module_vpc_endpoints_nocreate"></a> [vpc\_endpoints\_nocreate](#module\_vpc\_endpoints\_nocreate) | ../../modules/vpc-endpoints | | | <a name="module_vpc_endpoints_nocreate"></a> [vpc\_endpoints\_nocreate](#module\_vpc\_endpoints\_nocreate) | ../../modules/vpc-endpoints | n/a |
## Resources ## Resources
......
...@@ -30,7 +30,7 @@ No providers. ...@@ -30,7 +30,7 @@ No providers.
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../.. | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../.. | n/a |
## Resources ## Resources
......
...@@ -35,9 +35,9 @@ No providers. ...@@ -35,9 +35,9 @@ No providers.
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc_issue_108"></a> [vpc\_issue\_108](#module\_vpc\_issue\_108) | ../../ | | | <a name="module_vpc_issue_108"></a> [vpc\_issue\_108](#module\_vpc\_issue\_108) | ../../ | n/a |
| <a name="module_vpc_issue_44"></a> [vpc\_issue\_44](#module\_vpc\_issue\_44) | ../../ | | | <a name="module_vpc_issue_44"></a> [vpc\_issue\_44](#module\_vpc\_issue\_44) | ../../ | n/a |
| <a name="module_vpc_issue_46"></a> [vpc\_issue\_46](#module\_vpc\_issue\_46) | ../../ | | | <a name="module_vpc_issue_46"></a> [vpc\_issue\_46](#module\_vpc\_issue\_46) | ../../ | n/a |
## Resources ## Resources
......
...@@ -32,7 +32,7 @@ No providers. ...@@ -32,7 +32,7 @@ No providers.
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | n/a |
## Resources ## Resources
......
...@@ -34,7 +34,7 @@ No providers. ...@@ -34,7 +34,7 @@ No providers.
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | n/a |
## Resources ## Resources
......
...@@ -36,7 +36,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP ...@@ -36,7 +36,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | n/a |
## Resources ## Resources
......
...@@ -32,7 +32,7 @@ No providers. ...@@ -32,7 +32,7 @@ No providers.
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | n/a |
## Resources ## Resources
......
...@@ -36,7 +36,7 @@ No providers. ...@@ -36,7 +36,7 @@ No providers.
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | n/a |
## Resources ## Resources
......
...@@ -39,10 +39,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP ...@@ -39,10 +39,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 | | <a name="module_s3_bucket"></a> [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 1.0 |
| <a name="module_vpc_with_flow_logs_cloudwatch_logs"></a> [vpc\_with\_flow\_logs\_cloudwatch\_logs](#module\_vpc\_with\_flow\_logs\_cloudwatch\_logs) | ../../ | | | <a name="module_vpc_with_flow_logs_cloudwatch_logs"></a> [vpc\_with\_flow\_logs\_cloudwatch\_logs](#module\_vpc\_with\_flow\_logs\_cloudwatch\_logs) | ../../ | n/a |
| <a name="module_vpc_with_flow_logs_cloudwatch_logs_default"></a> [vpc\_with\_flow\_logs\_cloudwatch\_logs\_default](#module\_vpc\_with\_flow\_logs\_cloudwatch\_logs\_default) | ../../ | | | <a name="module_vpc_with_flow_logs_cloudwatch_logs_default"></a> [vpc\_with\_flow\_logs\_cloudwatch\_logs\_default](#module\_vpc\_with\_flow\_logs\_cloudwatch\_logs\_default) | ../../ | n/a |
| <a name="module_vpc_with_flow_logs_s3_bucket"></a> [vpc\_with\_flow\_logs\_s3\_bucket](#module\_vpc\_with\_flow\_logs\_s3\_bucket) | ../../ | | | <a name="module_vpc_with_flow_logs_s3_bucket"></a> [vpc\_with\_flow\_logs\_s3\_bucket](#module\_vpc\_with\_flow\_logs\_s3\_bucket) | ../../ | n/a |
| <a name="module_vpc_with_flow_logs_s3_bucket_parquet"></a> [vpc\_with\_flow\_logs\_s3\_bucket\_parquet](#module\_vpc\_with\_flow\_logs\_s3\_bucket\_parquet) | ../../ | | | <a name="module_vpc_with_flow_logs_s3_bucket_parquet"></a> [vpc\_with\_flow\_logs\_s3\_bucket\_parquet](#module\_vpc\_with\_flow\_logs\_s3\_bucket\_parquet) | ../../ | n/a |
## Resources ## Resources
......
...@@ -32,7 +32,7 @@ No providers. ...@@ -32,7 +32,7 @@ No providers.
| Name | Source | Version | | Name | Source | Version |
|------|--------|---------| |------|--------|---------|
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | | | <a name="module_vpc"></a> [vpc](#module\_vpc) | ../../ | n/a |
## Resources ## Resources
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment