make init script external #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# yamllint disable rule:line-length | |
name: Verify | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
permissions: read-all | |
env: | |
terraform: 1.3.0 | |
tf_target_dir: example/examplea | |
branch: master | |
GITHUB_API_TOKEN: ${{ github.token }} | |
jobs: | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3 | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
with: | |
ref: ${{ env.branch }} | |
token: ${{ github.token }} | |
fetch-depth: '0' | |
- name: Config Terraform plugin cache | |
run: | | |
echo "plugin_cache_dir=$HOME/.terraform.d/plugin-cache" >~/.terraformrc | |
mkdir --parents ~/.terraform.d/plugin-cache | |
- name: Cache Terraform | |
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2 | |
with: | |
path: | | |
~/.terraform.d/plugin-cache | |
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }} | |
restore-keys: | | |
${{ runner.os }}-terraform- | |
- name: Terraform Init | |
id: init | |
run: terraform init | |
working-directory: ${{ env.tf_target_dir }} | |
- name: Terraform validate | |
id: validate | |
run: terraform validate | |
working-directory: ${{ env.tf_target_dir }} | |
- name: Terraform plan | |
id: plan | |
run: terraform plan | |
working-directory: ${{ env.tf_target_dir }} | |
env: | |
GOOGLE_CLOUD_KEYFILE_JSON: ${{ secrets.GOOGLE_CLOUD_KEYFILE_JSON }} | |
security: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
with: | |
ref: ${{ env.branch }} | |
token: ${{ github.token }} | |
fetch-depth: '0' | |
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | |
with: | |
python-version: 3.11 | |
- run: | | |
mkdir "$GITHUB_WORKSPACE/bin" | |
wget https://github.com/terraform-docs/terraform-docs/releases/download/v0.16.0/terraform-docs-v0.16.0-linux-amd64.tar.gz | |
tar -xvf terraform-docs*.tar.gz --directory "$GITHUB_WORKSPACE/bin" | |
chmod +x "$GITHUB_WORKSPACE/bin/terraform-docs" | |
wget https://github.com/rhysd/actionlint/releases/download/v1.6.23/actionlint_1.6.23_linux_amd64.tar.gz | |
tar -xvf actionlint_1.6.23_linux_amd64.tar.gz --directory "$GITHUB_WORKSPACE/bin" | |
chmod +x "$GITHUB_WORKSPACE/bin/actionlint" | |
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH" | |
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0 | |
version: | |
permissions: write-all | |
name: versioning | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
with: | |
fetch-depth: '0' | |
- name: Bump version and push tag | |
uses: anothrNick/github-tag-action@a2c70ae13a881faf2b4953baaa9e49731997ab36 # 1.67.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: patch | |
WITH_V: "true" | |
needs: [terraform, security] |