Skip to content

Commit 96cc4c2

Browse files
author
Premdeep Saini
committed
feat: add pre-commit and release workflows
1 parent df6b404 commit 96cc4c2

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.github/workflows/pre_commit.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Pre-Commit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
env:
9+
TERRAFORM_DOCS_VERSION: v0.16.0
10+
11+
jobs:
12+
collectInputs:
13+
name: Collect workflow inputs
14+
runs-on: ubuntu-latest
15+
outputs:
16+
directories: ${{ steps.dirs.outputs.directories }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Get root directories
22+
id: dirs
23+
uses: clowdhaus/terraform-composite-actions/directories@v1.3.0
24+
25+
preCommitMinVersions:
26+
name: Min TF pre-commit
27+
needs: collectInputs
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v2
35+
36+
- name: Terraform min/max versions
37+
id: minMax
38+
uses: clowdhaus/terraform-min-max@v1.0.3
39+
with:
40+
directory: ${{ matrix.directory }}
41+
42+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
43+
# Run only validate pre-commit check on min version supported
44+
if: ${{ matrix.directory != '.' }}
45+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0
46+
with:
47+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
48+
args: 'terraform_validate --color=always --show-diff-on-failure --files ${{ matrix.directory }}/*'
49+
50+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.minVersion }}
51+
# Run only validate pre-commit check on min version supported
52+
if: ${{ matrix.directory == '.' }}
53+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0
54+
with:
55+
terraform-version: ${{ steps.minMax.outputs.minVersion }}
56+
args: 'terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)'
57+
58+
preCommitMaxVersion:
59+
name: Max TF pre-commit
60+
runs-on: ubuntu-latest
61+
needs: collectInputs
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v2
65+
with:
66+
ref: ${{ github.event.pull_request.head.ref }}
67+
repository: ${{github.event.pull_request.head.repo.full_name}}
68+
69+
- name: Terraform min/max versions
70+
id: minMax
71+
uses: clowdhaus/terraform-min-max@v1.0.3
72+
73+
- name: Pre-commit Terraform ${{ steps.minMax.outputs.maxVersion }}
74+
uses: clowdhaus/terraform-composite-actions/pre-commit@v1.3.0
75+
with:
76+
terraform-version: ${{ steps.minMax.outputs.maxVersion }}
77+
terraform-docs-version: ${{ env.TERRAFORM_DOCS_VERSION }}

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'ECS'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
jobs:
13+
release:
14+
name: Release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
with:
20+
persist-credentials: false
21+
fetch-depth: 0
22+
23+
- name: Release
24+
uses: cycjimmy/semantic-release-action@v2
25+
with:
26+
semantic_version: 18.0.0
27+
extra_plugins: |
28+
@semantic-release/changelog@6.0.0
29+
@semantic-release/git@10.0.0
30+
conventional-changelog-conventionalcommits@4.6.3
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)