Skip to content

Commit f93f88c

Browse files
authored
chore: add ci/cd github actions workflows for validating module changes and creating releases (#1)
1 parent 402de16 commit f93f88c

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '**.tf'
9+
- '!examples/**.tf'
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
persist-credentials: false
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: 14
26+
27+
- name: Release
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
30+
run: npx semantic-release
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: static-checks
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
versionExtract:
8+
name: Get min/max versions
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Terraform min/max versions
16+
id: minMax
17+
uses: clowdhaus/terraform-min-max@main
18+
outputs:
19+
minVersion: ${{ steps.minMax.outputs.minVersion }}
20+
maxVersion: ${{ steps.minMax.outputs.maxVersion }}
21+
22+
versionEvaluate:
23+
name: Evaluate Terraform versions
24+
runs-on: ubuntu-latest
25+
needs: versionExtract
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
version:
30+
- ${{ needs.versionExtract.outputs.minVersion }}
31+
- ${{ needs.versionExtract.outputs.maxVersion }}
32+
directory:
33+
- examples/mysql_iam_cluster
34+
- examples/mysql_iam_instance
35+
- examples/postgresql_iam_cluster
36+
- examples/postgresql_iam_instance
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v2
41+
42+
- name: Install Terraform v${{ matrix.version }}
43+
uses: hashicorp/setup-terraform@v1
44+
with:
45+
terraform_version: ${{ matrix.version }}
46+
47+
- name: Init & validate v${{ matrix.version }}
48+
run: |
49+
cd ${{ matrix.directory }}
50+
terraform init
51+
terraform validate
52+
53+
- name: tflint
54+
uses: reviewdog/action-tflint@master
55+
with:
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
57+
working_directory: ${{ matrix.directory }}
58+
fail_on_error: 'true'
59+
filter_mode: 'nofilter'
60+
flags: '--module'
61+
62+
format:
63+
name: Check code format
64+
runs-on: ubuntu-latest
65+
needs: versionExtract
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v2
70+
71+
- name: Install Terraform v${{ needs.versionExtract.outputs.maxVersion }}
72+
uses: hashicorp/setup-terraform@v1
73+
with:
74+
terraform_version: ${{ needs.versionExtract.outputs.maxVersion }}
75+
76+
- name: Check Terraform format changes
77+
run: terraform fmt --recursive -check=true

0 commit comments

Comments
 (0)