build(deps): bump docker/build-push-action from 5 to 6 #11
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
name: Continuous Integration | |
on: | |
pull_request: | |
branches: [dev, prd] | |
types: [opened, reopened, synchronize, edited] | |
workflow_dispatch: | |
env: | |
node_version: "20.x" | |
tf_version: "1.6.6" # must match value in iac/*/watchtower/main.tf | |
jobs: | |
env: | |
name: Set Env Vars | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up DEV Environment Variables | |
if: github.base_ref == 'dev' | |
run: | | |
matrix='{ | |
"env":[ | |
{ | |
"tf_working_dir":"./iac/dev/watchtower", | |
"aws_account":"543804410856", | |
"aws_gha_role":"watchtower-dev-gha" | |
} | |
] | |
}' | |
echo matrix=`echo $matrix | jq -c .` >> $GITHUB_ENV | |
- name: Set up PRD Environment Variables | |
if: github.base_ref == 'prd' | |
run: | | |
matrix='{ | |
"env":[ | |
{ | |
"tf_working_dir":"./iac/prd/watchtower", | |
"aws_account":"543804410856", | |
"aws_gha_role":"watchtower-prd-gha" | |
} | |
] | |
}' | |
echo matrix=`echo $matrix | jq -c .` >> $GITHUB_ENV | |
outputs: | |
matrix: ${{ env.matrix }} | |
test: | |
name: Test App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
- run: npm ci | |
working-directory: './' | |
- run: npm test --if-present | |
working-directory: './' | |
audit: | |
name: Audit App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
- run: npm audit --audit-level=critical | |
working-directory: './' | |
lint: | |
name: Lint App | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node_version }} | |
- run: npm ci | |
working-directory: './' | |
- run: npm run lint --if-present | |
working-directory: './' | |
docker: | |
name: Docker | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Run git checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Run docker build | |
run: docker build . | |
working-directory: './' | |
env: | |
DOCKER_BUILDKIT: 1 | |
format: | |
name: Terraform Format | |
runs-on: ubuntu-latest | |
needs: env | |
strategy: | |
matrix: ${{ fromJson(needs.env.outputs.matrix) }} | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Terraform Setup | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: ${{ env.tf_version }} | |
- name: Terraform Format | |
working-directory: './iac' | |
run: terraform fmt -check -recursive | |
plan: | |
name: Terraform Plan | |
runs-on: ubuntu-latest | |
needs: env | |
strategy: | |
matrix: ${{ fromJson(needs.env.outputs.matrix) }} | |
fail-fast: false | |
permissions: | |
contents: read | |
actions: read | |
pull-requests: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: "arn:aws:iam::${{ matrix.env.aws_account }}:role/${{ matrix.env.aws_gha_role }}" | |
role-session-name: ${{ github.sha }} | |
aws-region: us-west-2 | |
- name: Terraform Setup | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: ${{ env.tf_version }} | |
- name: Terraform Init | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
run: terraform init | |
- name: Terraform Plan | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
run: terraform plan -var 'image_tag=ci_test' -input=false -out plan | |
- name: Comment Terraform Plan | |
uses: byu-oit/github-action-tf-plan-comment@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
terraform-plan-file: plan | |
- name: Analyze Terraform Plan | |
uses: byu-oit/github-action-tf-plan-analyzer@v2 | |
with: | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
terraform-plan-file: plan | |
divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }} | |
divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }} |