-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
66 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ jobs: | |
- name: setup python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.5' | ||
python-version: "3.10.5" | ||
- name: Install packages | ||
run: | | ||
python -m pip install --upgrade pip | ||
|
@@ -56,7 +56,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
fetch-depth: 0 | ||
- uses: hadolint/[email protected] | ||
# Build and Push the Docker Image | ||
docker: | ||
|
@@ -103,70 +103,70 @@ jobs: | |
contents: write | ||
pull-requests: read | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: mikepenz/release-changelog-builder-action@v3 | ||
id: build_changelog | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
commit: main | ||
body: ${{ steps.build_changelog.outputs.changelog }} | ||
tag: ${{ needs.generate-semantic-version.outputs.next-version }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# Lint the Terraform Code and Deploy the Application via Terraform Cloud | ||
terraform: | ||
needs: [release, tfsec, generate-semantic-version, docker] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
- uses: actions/checkout@v2 | ||
with: | ||
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | ||
- name: Terraform Format | ||
id: fmt | ||
run: terraform fmt -check | ||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
- name: Terraform Validate | ||
id: validate | ||
run: terraform validate -no-color | ||
- name: Terraform Plan | ||
id: plan | ||
if: github.event_name == 'pull_request' | ||
run: terraform plan -no-color -input=false -var image_tag=${{ needs.generate-semantic-version.outputs.next-version }} | ||
continue-on-error: true | ||
- uses: actions/github-script@v6 | ||
if: github.event_name == 'pull_request' | ||
fetch-depth: 0 | ||
- uses: mikepenz/release-changelog-builder-action@v3 | ||
id: build_changelog | ||
env: | ||
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const output = `#### Terraform Format and Style π\`${{ steps.fmt.outcome }}\` | ||
#### Terraform Initialization βοΈ\`${{ steps.init.outcome }}\` | ||
#### Terraform Validation π€\`${{ steps.validate.outcome }}\` | ||
#### Terraform Plan π\`${{ steps.plan.outcome }}\` | ||
<details><summary>Show Plan</summary> | ||
\`\`\`\n | ||
${process.env.PLAN} | ||
\`\`\` | ||
</details> | ||
*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: output | ||
}) | ||
- name: Terraform Plan Status | ||
if: steps.plan.outcome == 'failure' | ||
run: exit 1 | ||
- name: Terraform Apply | ||
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
run: terraform apply -auto-approve -input=false -var image_tag=${{ needs.generate-semantic-version.outputs.next-version }} | ||
commit: main | ||
body: ${{ steps.build_changelog.outputs.changelog }} | ||
tag: ${{ needs.generate-semantic-version.outputs.next-version }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
# Lint the Terraform Code and Deploy the Application via Terraform Cloud | ||
# terraform: | ||
# needs: [release, tfsec, generate-semantic-version, docker] | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v3 | ||
# - name: Setup Terraform | ||
# uses: hashicorp/setup-terraform@v1 | ||
# with: | ||
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} | ||
# - name: Terraform Format | ||
# id: fmt | ||
# run: terraform fmt -check | ||
# - name: Terraform Init | ||
# id: init | ||
# run: terraform init | ||
# - name: Terraform Validate | ||
# id: validate | ||
# run: terraform validate -no-color | ||
# - name: Terraform Plan | ||
# id: plan | ||
# if: github.event_name == 'pull_request' | ||
# run: terraform plan -no-color -input=false -var image_tag=${{ needs.generate-semantic-version.outputs.next-version }} | ||
# continue-on-error: true | ||
# - uses: actions/github-script@v6 | ||
# if: github.event_name == 'pull_request' | ||
# env: | ||
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}" | ||
# with: | ||
# github-token: ${{ secrets.GITHUB_TOKEN }} | ||
# script: | | ||
# const output = `#### Terraform Format and Style π\`${{ steps.fmt.outcome }}\` | ||
# #### Terraform Initialization βοΈ\`${{ steps.init.outcome }}\` | ||
# #### Terraform Validation π€\`${{ steps.validate.outcome }}\` | ||
# #### Terraform Plan π\`${{ steps.plan.outcome }}\` | ||
# <details><summary>Show Plan</summary> | ||
# \`\`\`\n | ||
# ${process.env.PLAN} | ||
# \`\`\` | ||
# </details> | ||
# *Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | ||
# github.rest.issues.createComment({ | ||
# issue_number: context.issue.number, | ||
# owner: context.repo.owner, | ||
# repo: context.repo.repo, | ||
# body: output | ||
# }) | ||
# - name: Terraform Plan Status | ||
# if: steps.plan.outcome == 'failure' | ||
# run: exit 1 | ||
# - name: Terraform Apply | ||
# if: github.ref == 'refs/heads/main' && github.event_name == 'push' | ||
# run: terraform apply -auto-approve -input=false -var image_tag=${{ needs.generate-semantic-version.outputs.next-version }} |