diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 3b52907..ea28a13 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -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/hadolint-action@v2.0.0 # 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 }}\` -
Show Plan - \`\`\`\n - ${process.env.PLAN} - \`\`\` -
- *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 }} \ No newline at end of file + 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 }}\` + #
Show Plan + # \`\`\`\n + # ${process.env.PLAN} + # \`\`\` + #
+ # *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 }}