Skip to content

Adding folder change for make stage #15

Adding folder change for make stage

Adding folder change for make stage #15

Workflow file for this run

name: CI/CD Pipeline
on:
push:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
jobs:
get-metadata:
runs-on: ubuntu-latest
outputs:
build_datetime: ${{ steps.metadata.outputs.build_datetime }}
build_timestamp: ${{ steps.metadata.outputs.build_timestamp }}
build_epoch: ${{ steps.metadata.outputs.build_epoch }}
nodejs_version: ${{ steps.metadata.outputs.nodejs_version }}
terraform_version: ${{ steps.metadata.outputs.terraform_version }}
steps:
- uses: actions/checkout@v3
- id: metadata
run: |
datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
echo "nodejs_version=$(grep nodejs .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
echo "terraform_version=$(grep terraform .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
scan-secrets:
uses: ./.github/workflows/scan-secrets.yaml
check-file-format:
uses: ./.github/workflows/check-file-format.yaml
check-markdown-format:
uses: ./.github/workflows/check-markdown-format.yaml
check-terraform-format:
uses: ./.github/workflows/check-terraform-format.yaml
cloc-repository:
uses: ./.github/workflows/cloc-repository.yaml
cicd-pipeline-test:
runs-on: ubuntu-latest
needs:
[
get-metadata,
scan-secrets,
check-file-format,
check-markdown-format,
check-terraform-format,
cloc-repository,
]
timeout-minutes: 10
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ needs.get-metadata.outputs.terraform_version }}
- name: Authenticate with AWS over OIDC
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN_EXAMPLE }}
aws-region: ${{ secrets.AWS_REGION }}
- name: List Variables
run: |
export BUILD_DATETIME="${{ needs.get-metadata.outputs.build_datetime }}"
export BUILD_TIMESTAMP="${{ needs.get-metadata.outputs.build_timestamp }}"
export BUILD_EPOCH="${{ needs.get-metadata.outputs.build_epoch }}"
make list-variables
- name: Test Terraform
run: |
cd examples
make \
terraform-init \
terraform-plan \
terraform-apply \
terraform-destroy
cicd-pipeline-build:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: [get-metadata, cicd-pipeline-test]
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: List Variables
run: |
export BUILD_DATETIME="${{ needs.get-metadata.outputs.build_datetime }}"
export BUILD_TIMESTAMP="${{ needs.get-metadata.outputs.build_timestamp }}"
export BUILD_EPOCH="${{ needs.get-metadata.outputs.build_epoch }}"
make list-variables
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "${{ needs.get-metadata.outputs.nodejs_version }}"
cache: yarn
# - name: Authenticate with AWS over OIDC
# uses: aws-actions/configure-aws-credentials@v2
# with:
# role-to-assume: ${{ secrets.ASSUME_ROLE_ARN }}
# role-session-name: react-app-s3-role
# aws-region: ${{ secrets.AWS_REGION }}
- name: Copy files to the AWS S3 website content bucket
run: |
make example-build
#make example-upload AWS_S3_BUCKET_NAME=${{ secrets.AWS_S3_BUCKET_NAME }}