update: add styles for Military section; add'l edits #159
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: Deploy Frontend | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write # this is required for requesting the JWT | |
contents: read # this is required for actions/checkout | |
jobs: | |
terraform: | |
name: Deploy Frontend Infrastructure | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./iac | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Check Linting of Terraform files | |
uses: devops-infra/action-tflint@v0.3 | |
- name: Run tfsec (static analysis) | |
uses: aquasecurity/tfsec-action@v1.0.0 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: arn:aws:iam::814913991817:role/GitHubActionsRole-frontend | |
aws-region: us-east-1 | |
- name: Terraform Setup | |
uses: hashicorp/setup-terraform@v1 | |
- name: Terraform Format | |
run: terraform fmt -recursive | |
- name: Terraform Init | |
run: terraform init | |
- name: Terraform Validate | |
run: terraform validate | |
- name: Terraform Plan | |
run: terraform plan | |
- name: Terraform Apply | |
run: terraform apply -auto-approve | |
sync_s3: | |
name: Sync files to S3 Bucket | |
needs: terraform | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --delete --exclude '.DS_Store' | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_S3_BUCKET: "danwadleigh.dev" | |
AWS_REGION: "us-east-1" | |
SOURCE_DIR: "./website" | |
invalidate_cloudfront: | |
name: Invalidate CloudFront Distribution | |
needs: sync_s3 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: arn:aws:iam::814913991817:role/GitHubActionsRole-frontend | |
aws-region: us-east-1 | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@v2 | |
env: | |
DISTRIBUTION: ${{ secrets.DISTRIBUTION }} | |
PATHS: "/*" | |
AWS_REGION: "us-east-1" | |
cypress-run: | |
name: E2E Tests | |
needs: invalidate_cloudfront | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.11.0 | |
- name: Cypress run | |
uses: cypress-io/github-action@v6 | |
with: | |
working-directory: ./tests | |