<commit_before>name: Daily Production Deploy

on:
  workflow_dispatch:
    inputs:
      release_wait:
        description: Minutes to wait before creating release
        required: false
        default: 5
      commit_sha:
        description: Deploy specific commit
        required: false
  schedule:
    - cron: 0 19 * * 1-5

env:
  CHANNEL_ID: C0MQ281DJ # vfs-platform-builds
  VETS_WEBSITE_CHANNEL_ID: C02V265VCGH # status-vets-website
  DSVA_SCHEDULE_ENABLED: true
  BUILD_ENV: vagovprod

jobs:
  get-workflow-environment:
    runs-on: ubuntu-latest
    outputs:
      environment_name: ${{ steps.check-environment.outputs.env_name }}
    steps:
      - name: Check environment
        id: check-environment
        run: |
          if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
            echo ::set-output name=env_name::'production'
          else
            echo ::set-output name=env_name::''
          fi
  set-env:
    name: Set Env Variables
    runs-on: ubuntu-latest
    outputs:
      LATEST_TAG_VERSION: ${{ steps.get-latest-tag.outputs.LATEST_TAG_VERSION }}
      RELEASE_WAIT: ${{ env.RELEASE_WAIT }}
      COMMIT_SHA: ${{ env.COMMIT_SHA }}

    steps:
      - name: Cancel workflow due to DSVA schedule
        if: ${{ env.DSVA_SCHEDULE_ENABLED != 'true' }}
        uses: andymckay/cancel-action@0.2

      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Get latest tag
        id: get-latest-tag
        run: echo ::set-output name=LATEST_TAG_VERSION::$(git describe --tags --abbrev=0)

      - name: Get release wait time (scheduled release)
        if: ${{ github.event.schedule != '' }}
        run: echo 'RELEASE_WAIT=0' >> $GITHUB_ENV

      - name: Get release wait time (workflow_dispatch)
        if: ${{ github.event_name == 'workflow_dispatch' }}
        run: echo 'RELEASE_WAIT=${{ github.event.inputs.release_wait }}' >> $GITHUB_ENV

      - name: Get commit sha (latest commit)
        if: ${{ github.event.schedule != '' || (github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha == '') }}
        run: echo 'COMMIT_SHA=${{ github.sha }}' >> $GITHUB_ENV

      - name: Get commit sha (workflow_dispatch)
        if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha != '' }}
        run: echo 'COMMIT_SHA=${{ github.event.inputs.commit_sha }}' >> $GITHUB_ENV

  validate-build-status:
    name: Validate Build Status
    runs-on: ubuntu-latest
    needs: set-env
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install dependencies
        uses: ./.github/workflows/install
        timeout-minutes: 30
        with:
          key: ${{ hashFiles('yarn.lock') }}
          yarn_cache_folder: ~/.cache/yarn
          path: |
            ~/.cache/yarn
            node_modules

      - name: Validate build status
        run: node ./script/github-actions/validate-build-status.js ${{ needs.set-env.outputs.COMMIT_SHA }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  notify-start:
    name: Notify Start
    runs-on: ubuntu-latest
    needs: set-env
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Notify Slack
        uses: ./.github/workflows/slack-notify
        continue-on-error: true
        with:
          payload: '{"attachments": [{"color": "#07711E","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "Stand by, production deploy for vets-website coming up in ${{ fromJSON(needs.set-env.outputs.RELEASE_WAIT) < 5 && "a few" || needs.set-env.outputs.RELEASE_WAIT }} minutes. View what coming here: <https://github.com/${{ github.repository }}/compare/${{ needs.set-env.outputs.LATEST_TAG_VERSION }}...${{ needs.set-env.outputs.COMMIT_SHA }}>"}}]}]}'
          channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

  build:
    name: Build
    runs-on: self-hosted
    needs: [set-env, notify-start, validate-build-status]
    
    env:
      NODE_EXTRA_CA_CERTS: /etc/ssl/certs/VA-Internal-S2-RCA1-v1.cer.pem
    
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: ${{ needs.set-env.outputs.COMMIT_SHA }}

      - name: Install dependencies
        uses: ./.github/workflows/install
        with:
          key: ${{ hashFiles('yarn.lock') }}
          yarn_cache_folder: .cache/yarn
          path: |
            .cache/yarn
            node_modules

      - name: Build
        run: yarn build --verbose --buildtype=${{ env.BUILD_ENV }}
        timeout-minutes: 30

      - name: Generate build details
        run: |
          cat > build/${{ env.BUILD_ENV }}/BUILD.txt << EOF
          BUILDTYPE=${{ env.BUILD_ENV }}
          NODE_ENV=production
          BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
          CHANGE_TARGET=null
          RUN_ID=${{ github.run_id }}
          RUN_NUMBER=${{ github.run_number }}
          REF=${{ needs.set-env.outputs.COMMIT_SHA }}
          BUILDTIME=$(date +%s)
          EOF

      - name: Compress and archive build
        run: tar -C build/${{ env.BUILD_ENV }} -cjf ${{ env.BUILD_ENV }}.tar.bz2 .

      - name: Upload build artifact
        uses: actions/upload-artifact@v3
        with:
          name: ${{ env.BUILD_ENV }}.tar.bz2
          path: ${{ env.BUILD_ENV }}.tar.bz2
          retention-days: 1

  archive:
    name: Archive
    runs-on: ubuntu-latest
    needs: [set-env, build]

    steps:
      - name: Download build artifact
        uses: actions/download-artifact@v3
        with:
          name: ${{ env.BUILD_ENV }}.tar.bz2

      - name: Configure AWS credentials (1)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1

      - name: Get AWS IAM role
        uses: marvinpinto/action-inject-ssm-secrets@v1.2.1
        with:
          ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_NONPROD_ROLE
          env_variable_name: AWS_FRONTEND_NONPROD_ROLE

      - name: Configure AWS Credentials (2)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1
          role-to-assume: ${{ env.AWS_FRONTEND_NONPROD_ROLE }}
          role-duration-seconds: 900
          role-session-name: vsp-frontendteam-githubaction

      - name: Upload build
        run: aws s3 cp ${{ env.BUILD_ENV }}.tar.bz2 s3://vetsgov-website-builds-s3-upload/${{ needs.set-env.outputs.COMMIT_SHA }}/${{ env.BUILD_ENV }}.tar.bz2 --acl public-read --region us-gov-west-1
  
  create-release:
    name: Create Release
    runs-on: ubuntu-latest
    needs: [set-env, notify-start, validate-build-status, archive]
    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1

      - name: Get bot token from Parameter Store
        uses: marvinpinto/action-inject-ssm-secrets@v1.2.1
        with:
          ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
          env_variable_name: VA_VSP_BOT_GITHUB_TOKEN

      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}

      - name: Waiting to release
        run: |
          echo 'Waiting to release: https://github.com/${{ github.repository }}/compare/${{ needs.set-env.outputs.LATEST_TAG_VERSION }}...${{ needs.set-env.outputs.COMMIT_SHA }}'

      - name: Sleep for ${{ needs.set-env.outputs.RELEASE_WAIT }} minutes
        uses: whatnick/wait-action@master
        with:
          time: ${{ needs.set-env.outputs.RELEASE_WAIT }}m

      - name: Get next tag version
        id: bump-tag-version
        uses: WyriHaximus/github-action-next-semvers@v1
        with:
          version: ${{ needs.set-env.outputs.LATEST_TAG_VERSION }}

      - name: Create tag
        run: git tag ${{ steps.bump-tag-version.outputs.v_patch }} ${{ needs.set-env.outputs.COMMIT_SHA }} && git push origin ${{ steps.bump-tag-version.outputs.v_patch }}

      - name: Create release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.bump-tag-version.outputs.v_patch }}
          release_name: vets-website/${{ steps.bump-tag-version.outputs.v_patch }}

  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    needs: [set-env, create-release, get-workflow-environment]
    environment: ${{ needs.get-workflow-environment.outputs.environment_name }}

    env:
      DEPLOY_BUCKET: www.va.gov
      ASSET_BUCKET: prod-va-gov-assets

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Configure AWS credentials (1)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1

      - name: Get AWS IAM role
        uses: marvinpinto/action-inject-ssm-secrets@v1.2.1
        with:
          ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_PROD_ROLE
          env_variable_name: AWS_FRONTEND_PROD_ROLE

      - name: Configure AWS Credentials (2)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1
          role-to-assume: ${{ env.AWS_FRONTEND_PROD_ROLE }}
          role-duration-seconds: 900
          role-session-name: vsp-frontendteam-githubaction

      - name: Deploy
        run: ./script/github-actions/deploy.sh -s $SRC -d $DEST -a $ASSET_DEST -v
        env:
          SRC: s3://vetsgov-website-builds-s3-upload/${{ needs.set-env.outputs.COMMIT_SHA }}/${{ env.BUILD_ENV }}.tar.bz2
          DEST: s3://${{ env.DEPLOY_BUCKET }}
          ASSET_DEST: s3://${{ env.ASSET_BUCKET }}

  notify-success:
    name: Notify Success
    runs-on: ubuntu-latest
    needs: deploy

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Notify Slack
        uses: ./.github/workflows/slack-notify
        continue-on-error: true
        with:
          payload: '{"attachments": [{"color": "#07711E","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "Successfully deployed vets-website to production"}}]}]}'
          channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

  notify-failure:
    name: Notify Failure
    runs-on: ubuntu-latest
    if: ${{ failure() || cancelled() }}
    needs: deploy

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Notify Slack
        if: ${{ env.DSVA_SCHEDULE_ENABLED == 'true' }}
        uses: ./.github/workflows/slack-notify
        continue-on-error: true
        with:
          payload: '{"attachments": [{"color": "#FF0800","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "<!here> Production deploy for vets-website has failed!: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}>"}}]}]}'
          channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
<commit_msg>Fix double quotes syntax error (#22142)<commit_after>name: Daily Production Deploy

on:
  workflow_dispatch:
    inputs:
      release_wait:
        description: Minutes to wait before creating release
        required: false
        default: 5
      commit_sha:
        description: Deploy specific commit
        required: false
  schedule:
    - cron: 0 19 * * 1-5

env:
  CHANNEL_ID: C0MQ281DJ # vfs-platform-builds
  VETS_WEBSITE_CHANNEL_ID: C02V265VCGH # status-vets-website
  DSVA_SCHEDULE_ENABLED: true
  BUILD_ENV: vagovprod

jobs:
  get-workflow-environment:
    runs-on: ubuntu-latest
    outputs:
      environment_name: ${{ steps.check-environment.outputs.env_name }}
    steps:
      - name: Check environment
        id: check-environment
        run: |
          if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
            echo ::set-output name=env_name::'production'
          else
            echo ::set-output name=env_name::''
          fi
  set-env:
    name: Set Env Variables
    runs-on: ubuntu-latest
    outputs:
      LATEST_TAG_VERSION: ${{ steps.get-latest-tag.outputs.LATEST_TAG_VERSION }}
      RELEASE_WAIT: ${{ env.RELEASE_WAIT }}
      COMMIT_SHA: ${{ env.COMMIT_SHA }}

    steps:
      - name: Cancel workflow due to DSVA schedule
        if: ${{ env.DSVA_SCHEDULE_ENABLED != 'true' }}
        uses: andymckay/cancel-action@0.2

      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Get latest tag
        id: get-latest-tag
        run: echo ::set-output name=LATEST_TAG_VERSION::$(git describe --tags --abbrev=0)

      - name: Get release wait time (scheduled release)
        if: ${{ github.event.schedule != '' }}
        run: echo 'RELEASE_WAIT=0' >> $GITHUB_ENV

      - name: Get release wait time (workflow_dispatch)
        if: ${{ github.event_name == 'workflow_dispatch' }}
        run: echo 'RELEASE_WAIT=${{ github.event.inputs.release_wait }}' >> $GITHUB_ENV

      - name: Get commit sha (latest commit)
        if: ${{ github.event.schedule != '' || (github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha == '') }}
        run: echo 'COMMIT_SHA=${{ github.sha }}' >> $GITHUB_ENV

      - name: Get commit sha (workflow_dispatch)
        if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit_sha != '' }}
        run: echo 'COMMIT_SHA=${{ github.event.inputs.commit_sha }}' >> $GITHUB_ENV

  validate-build-status:
    name: Validate Build Status
    runs-on: ubuntu-latest
    needs: set-env
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Install dependencies
        uses: ./.github/workflows/install
        timeout-minutes: 30
        with:
          key: ${{ hashFiles('yarn.lock') }}
          yarn_cache_folder: ~/.cache/yarn
          path: |
            ~/.cache/yarn
            node_modules

      - name: Validate build status
        run: node ./script/github-actions/validate-build-status.js ${{ needs.set-env.outputs.COMMIT_SHA }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  notify-start:
    name: Notify Start
    runs-on: ubuntu-latest
    needs: set-env
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Notify Slack
        uses: ./.github/workflows/slack-notify
        continue-on-error: true
        with:
          payload: '{"attachments": [{"color": "#07711E","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "Stand by, production deploy for vets-website coming up in ${{ fromJSON(needs.set-env.outputs.RELEASE_WAIT) < 5 && 'a few' || needs.set-env.outputs.RELEASE_WAIT }} minutes. View what is coming here: <https://github.com/${{ github.repository }}/compare/${{ needs.set-env.outputs.LATEST_TAG_VERSION }}...${{ needs.set-env.outputs.COMMIT_SHA }}>"}}]}]}'
          channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

  build:
    name: Build
    runs-on: self-hosted
    needs: [set-env, notify-start, validate-build-status]
    
    env:
      NODE_EXTRA_CA_CERTS: /etc/ssl/certs/VA-Internal-S2-RCA1-v1.cer.pem
    
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          ref: ${{ needs.set-env.outputs.COMMIT_SHA }}

      - name: Install dependencies
        uses: ./.github/workflows/install
        with:
          key: ${{ hashFiles('yarn.lock') }}
          yarn_cache_folder: .cache/yarn
          path: |
            .cache/yarn
            node_modules

      - name: Build
        run: yarn build --verbose --buildtype=${{ env.BUILD_ENV }}
        timeout-minutes: 30

      - name: Generate build details
        run: |
          cat > build/${{ env.BUILD_ENV }}/BUILD.txt << EOF
          BUILDTYPE=${{ env.BUILD_ENV }}
          NODE_ENV=production
          BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}")
          CHANGE_TARGET=null
          RUN_ID=${{ github.run_id }}
          RUN_NUMBER=${{ github.run_number }}
          REF=${{ needs.set-env.outputs.COMMIT_SHA }}
          BUILDTIME=$(date +%s)
          EOF

      - name: Compress and archive build
        run: tar -C build/${{ env.BUILD_ENV }} -cjf ${{ env.BUILD_ENV }}.tar.bz2 .

      - name: Upload build artifact
        uses: actions/upload-artifact@v3
        with:
          name: ${{ env.BUILD_ENV }}.tar.bz2
          path: ${{ env.BUILD_ENV }}.tar.bz2
          retention-days: 1

  archive:
    name: Archive
    runs-on: ubuntu-latest
    needs: [set-env, build]

    steps:
      - name: Download build artifact
        uses: actions/download-artifact@v3
        with:
          name: ${{ env.BUILD_ENV }}.tar.bz2

      - name: Configure AWS credentials (1)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1

      - name: Get AWS IAM role
        uses: marvinpinto/action-inject-ssm-secrets@v1.2.1
        with:
          ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_NONPROD_ROLE
          env_variable_name: AWS_FRONTEND_NONPROD_ROLE

      - name: Configure AWS Credentials (2)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1
          role-to-assume: ${{ env.AWS_FRONTEND_NONPROD_ROLE }}
          role-duration-seconds: 900
          role-session-name: vsp-frontendteam-githubaction

      - name: Upload build
        run: aws s3 cp ${{ env.BUILD_ENV }}.tar.bz2 s3://vetsgov-website-builds-s3-upload/${{ needs.set-env.outputs.COMMIT_SHA }}/${{ env.BUILD_ENV }}.tar.bz2 --acl public-read --region us-gov-west-1
  
  create-release:
    name: Create Release
    runs-on: ubuntu-latest
    needs: [set-env, notify-start, validate-build-status, archive]
    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1

      - name: Get bot token from Parameter Store
        uses: marvinpinto/action-inject-ssm-secrets@v1.2.1
        with:
          ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
          env_variable_name: VA_VSP_BOT_GITHUB_TOKEN

      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
          token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}

      - name: Waiting to release
        run: |
          echo 'Waiting to release: https://github.com/${{ github.repository }}/compare/${{ needs.set-env.outputs.LATEST_TAG_VERSION }}...${{ needs.set-env.outputs.COMMIT_SHA }}'

      - name: Sleep for ${{ needs.set-env.outputs.RELEASE_WAIT }} minutes
        uses: whatnick/wait-action@master
        with:
          time: ${{ needs.set-env.outputs.RELEASE_WAIT }}m

      - name: Get next tag version
        id: bump-tag-version
        uses: WyriHaximus/github-action-next-semvers@v1
        with:
          version: ${{ needs.set-env.outputs.LATEST_TAG_VERSION }}

      - name: Create tag
        run: git tag ${{ steps.bump-tag-version.outputs.v_patch }} ${{ needs.set-env.outputs.COMMIT_SHA }} && git push origin ${{ steps.bump-tag-version.outputs.v_patch }}

      - name: Create release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ steps.bump-tag-version.outputs.v_patch }}
          release_name: vets-website/${{ steps.bump-tag-version.outputs.v_patch }}

  deploy:
    name: Deploy
    runs-on: ubuntu-latest
    needs: [set-env, create-release, get-workflow-environment]
    environment: ${{ needs.get-workflow-environment.outputs.environment_name }}

    env:
      DEPLOY_BUCKET: www.va.gov
      ASSET_BUCKET: prod-va-gov-assets

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Configure AWS credentials (1)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1

      - name: Get AWS IAM role
        uses: marvinpinto/action-inject-ssm-secrets@v1.2.1
        with:
          ssm_parameter: /frontend-team/github-actions/parameters/AWS_FRONTEND_PROD_ROLE
          env_variable_name: AWS_FRONTEND_PROD_ROLE

      - name: Configure AWS Credentials (2)
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-gov-west-1
          role-to-assume: ${{ env.AWS_FRONTEND_PROD_ROLE }}
          role-duration-seconds: 900
          role-session-name: vsp-frontendteam-githubaction

      - name: Deploy
        run: ./script/github-actions/deploy.sh -s $SRC -d $DEST -a $ASSET_DEST -v
        env:
          SRC: s3://vetsgov-website-builds-s3-upload/${{ needs.set-env.outputs.COMMIT_SHA }}/${{ env.BUILD_ENV }}.tar.bz2
          DEST: s3://${{ env.DEPLOY_BUCKET }}
          ASSET_DEST: s3://${{ env.ASSET_BUCKET }}

  notify-success:
    name: Notify Success
    runs-on: ubuntu-latest
    needs: deploy

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Notify Slack
        uses: ./.github/workflows/slack-notify
        continue-on-error: true
        with:
          payload: '{"attachments": [{"color": "#07711E","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "Successfully deployed vets-website to production"}}]}]}'
          channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

  notify-failure:
    name: Notify Failure
    runs-on: ubuntu-latest
    if: ${{ failure() || cancelled() }}
    needs: deploy

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Notify Slack
        if: ${{ env.DSVA_SCHEDULE_ENABLED == 'true' }}
        uses: ./.github/workflows/slack-notify
        continue-on-error: true
        with:
          payload: '{"attachments": [{"color": "#FF0800","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "<!here> Production deploy for vets-website has failed!: <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}>"}}]}]}'
          channel_id: ${{ env.VETS_WEBSITE_CHANNEL_ID }}
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

{'fraction_non_alphanumeric': 0.1361045229476137, 'fraction_numerical': 0.008529938001914036, 'mean_word_length': 2.3246645455803017, 'pattern_counts': {'":': 42, '<': 15, '<?xml version=': 0, '>': 27, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2264221', 'n_tokens_mistral': 8252, 'n_tokens_neox': 7856, 'n_words': 1484}