Skip to content

Commit

Permalink
resolved yarn conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mreed-maphabit committed Oct 10, 2024
2 parents 22cfc50 + 68b409b commit 1a78e5f
Show file tree
Hide file tree
Showing 1,175 changed files with 5,732 additions and 4,725 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
run: tar -c main/out/ -cf ${{ env.BUILD_TYPE }}.tar.bz2 .

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/content-release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Content release: Dev"
on:
# Can be manually triggered
workflow_dispatch:
# Runs 5:05 am EDT Monday to Friday.
# This currently UTC -> EDT.
schedule:
- cron: "05 9 * * 1-5"
# Runs each time there is a new Production Tag created.
workflow_run:
workflows: ['Create Production Tag']
types: [completed]
branches: [main]

concurrency: next-build-content-release-dev

jobs:
content-release-dev:
# This job should run for any valid event besides workflow_run, or workflow_run if the conclusion was successful.
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
uses: department-of-veterans-affairs/next-build/.github/workflows/content-release.yml@main
with:
build_type: "dev"
secrets: inherit


23 changes: 23 additions & 0 deletions .github/workflows/content-release-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Content release: Prod"
on:
# Can be manually triggered
workflow_dispatch:
# Runs automatically every 30 minutes from 8am to 8pm Monday to Friday.
# This currently UTC -> EDT.
schedule:
- cron: "*/30 0,12-23 * * 1-5"
# Runs on API call. Used for CMS-driven build triggers.
repository_dispatch:
types: [content-release]

concurrency: next-build-content-release-prod

jobs:
content-release:
uses: department-of-veterans-affairs/next-build/.github/workflows/content-release.yml@main
with:
build_type: "prod"
secrets: inherit



26 changes: 26 additions & 0 deletions .github/workflows/content-release-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Content release: Staging"
on:
# Can be manually triggered
workflow_dispatch:
# Runs 5:35 am EDT Monday to Friday.
# This currently UTC -> EDT.
schedule:
- cron: "35 9 * * 1-5"
# Runs each time there is a new Production Tag created.
workflow_run:
workflows: ['Create Production Tag']
types: [completed]
branches: [main]

concurrency: next-build-content-release-staging

jobs:
content-release-staging:
# This job should run for any valid event besides workflow_run, or workflow_run if the conclusion was successful.
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
uses: department-of-veterans-affairs/next-build/.github/workflows/content-release.yml@main
with:
build_type: "staging"
secrets: inherit


97 changes: 70 additions & 27 deletions .github/workflows/content-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ permissions:
contents: read # This is required for actions/checkout

on:
repository_dispatch:
types: [content-release]
workflow_run:
workflows: ['Create Production Tag']
types: [completed]
branches: [main]
# Runs when called from other workflows. Used for ongoing releases for dev/staging/prod.
workflow_call:
inputs:
build_type:
type: string
description: "Environment this workflow runs against"
required: true
default: 'PROD'
# Manual release.
workflow_dispatch:
inputs:
build_type:
Expand All @@ -31,7 +27,7 @@ on:
- prod

concurrency:
group: ${{ inputs.build_type || 'prod' }}
group: ${{ inputs.build_type || 'prod' }}

env:
SLACK_CHANNEL: C06DSBT7CBW #status-next-build
Expand All @@ -42,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down Expand Up @@ -107,7 +103,7 @@ jobs:
continue-on-error: true
with:
payload: '{"attachments": [{"color": "#2EB67D","blocks": [{"type": "section","text": {"type": "mrkdwn","text": "Stand by, content release for next-build coming up (using ${{ needs.validate-build-status.outputs.TAG }}). <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}>"}}]}]}'
channel_id: ${{ env.SLACK_CHANNEL }}
channel_id: ${{ env.SLACK_CHANNEL }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Expand All @@ -133,14 +129,14 @@ jobs:
env:
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
APP_ENV: ${{ inputs.build_type || 'prod' }}


ports:
- 80
volumes:
- /etc/ssl/certs:/etc/ssl/certs
steps:

- name: Export setup start time
id: export-setup-start-time
run: echo SETUP_START_TIME=$(date +"%s") >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -197,8 +193,8 @@ jobs:
retry_on: error
timeout_minutes: 70
command: |
cd main && BUILD_OPTION=static yarn export --DRUPAL_CLIENT_ID ${{ secrets.PROD_DRUPAL_CLIENT_ID }} --DRUPAL_CLIENT_SECRET ${{ secrets.PROD_DRUPAL_CLIENT_SECRET }} --no-USE_REDIS | tee -a yarnoutput
echo YARN_OUTPUT=$(<yarnoutput)
cd main && BUILD_OPTION=static yarn export --DRUPAL_CLIENT_ID ${{ secrets.PROD_DRUPAL_CLIENT_ID }} --DRUPAL_CLIENT_SECRET ${{ secrets.PROD_DRUPAL_CLIENT_SECRET }} --no-USE_REDIS | tee yarnoutput
echo YARN_OUTPUT=$(<yarnoutput) >> $GITHUB_OUTPUT
ls
ls out
if [[ $? -ne 0 ]]; then
Expand All @@ -208,15 +204,57 @@ jobs:
cd out
ls -l
fi
#command: cd main && yarn export --NEXT_PUBLIC_DRUPAL_BASE_URL https://content-build-medc0xjkxm4jmpzxl3tfbcs7qcddsivh.ci.cms.va.gov --NEXT_IMAGE_DOMAIN https://content-build-medc0xjkxm4jmpzxl3tfbcs7qcddsivh.ci.cms.va.gov --SITE_URL https://www.va.gov --DRUPAL_CLIENT_ID ${{ secrets.PROD_DRUPAL_CLIENT_ID }} --DRUPAL_CLIENT_SECRET ${{ secrets.PROD_DRUPAL_CLIENT_SECRET }} --no-USE_REDIS

- name: Build sitemap
run: cd main && yarn build:sitemap
run: |
cd main && yarn build:sitemap
cd out
if [ -f sitemap.xml ]; then
echo "File found!"
cp sitemap.xml sitemap-nb.xml
else
touch sitemap-nb.xml
fi
shell: bash

- name: setup bucket descriptor
id: bucket-descriptor
run: |
if [ "${{ inputs.build_type }}" == 'dev' ]; then
echo NEXT_SITEMAP_LOCATION="https://dev.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT
echo OLD_SITEMAP_LOCATION="https://dev.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT
elif [ "${{ inputs.build_type }}" == 'staging'] ; then
echo NEXT_SITEMAP_LOCATION="https://staging.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT
echo OLD_SITEMAP_LOCATION="https://staging.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT
elif [ "${{ inputs.build_type }}" == 'prod' ]; then
echo NEXT_SITEMAP_LOCATION="https://www.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT
echo OLD_SITEMAP_LOCATION="https://www.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT
else
echo NEXT_SITEMAP_LOCATION="https://www.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT
echo OLD_SITEMAP_LOCATION="https://www.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Generate new sitemap
run: |
cd main
cd out
echo "${{steps.bucket-descriptor.outputs.OLD_SITEMAP_LOCATION}}"
cat <<'EOF' >> sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>${{steps.bucket-descriptor.outputs.NEXT_SITEMAP_LOCATION}}</loc>
</sitemap>
<sitemap>
<loc>${{steps.bucket-descriptor.outputs.OLD_SITEMAP_LOCATION}}</loc>
</sitemap>
</sitemapindex>
EOF
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand All @@ -240,7 +278,7 @@ jobs:
DEST: s3://next-content.dev.va.gov
- if: inputs.build_type == 'staging'
name: Deploy to S3
run: |
run: |
cd main && ./scripts/github-actions/deploy.sh -s $SRC -d $DEST -v
ls
cd out
Expand All @@ -254,14 +292,18 @@ jobs:
env:
SRC: ./out/
DEST: s3://next-content.www.va.gov
- if: inputs.build_type == ''

- if: inputs.build_type == ''
name: Deploy to S3
run: cd main && ./scripts/github-actions/deploy.sh -s $SRC -d $DEST -v
env:
SRC: ./out/
DEST: s3://next-content.www.va.gov


- name: Export deploy end time
id: export-deploy-end-time
run: echo DEPLOY_END_TIME=$(date +"%s") >> $GITHUB_OUTPUT

notify-success:
name: Notify Success
needs: [validate-build-status, build]
Expand All @@ -281,7 +323,7 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down Expand Up @@ -335,7 +377,7 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down Expand Up @@ -379,7 +421,7 @@ jobs:
METRIC_NAMESPACE: dsva_vagov.next_build
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v4
#uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get current timestamp
Expand All @@ -391,15 +433,16 @@ jobs:
echo "DEPLOY_ENV=${{ inputs.build_type || 'prod' }}" >> $GITHUB_ENV
echo "BUILD_TRIGGER=cms" >> $GITHUB_ENV
# Calculate all of our metrics that we send to data dog
- name: Calculate durations
run: |
echo "SETUP_DURATION=$(expr ${{needs.build.outputs.SETUP_END_TIME}} - ${{needs.build.outputs.SETUP_START_TIME}})" >> $GITHUB_ENV
echo "BUILD_DURATION=$(expr ${{needs.build.outputs.BUILD_END_TIME}} - ${{needs.build.outputs.BUILD_START_TIME}})" >> $GITHUB_ENV
echo "NEXT_BUILD_DURATION=$(expr ${{needs.build.outputs.BUILD_END_TIME}} - ${{needs.build.outputs.BUILD_START_TIME}})" >> $GITHUB_ENV
echo "OVERALL_DURATION=$(expr ${{needs.build.outputs.DEPLOY_END_TIME}} - ${{needs.validate-build-status.outputs.APPROX_WORKFLOW_START_TIME}})" >> $GITHUB_ENV
echo "DEPLOY_DURATION=$(expr ${{needs.build.outputs.DEPLOY_END_TIME}} - ${{needs.build.outputs.DEPLOY_START_TIME}})" >> $GITHUB_ENV
echo "${{needs.build.outputs.YARN_OUTPUT}}" >> yarn.out
echo "BUILT_PAGES=$(grep -oE "*\/([0-9]{4,})" ./yarn.out | head -1 | sed 's/\///g')" >> $GITHUB_ENV
echo "${{needs.build.outputs.YARN_OUTPUT}}" >> yarnoutput
echo "BUILT_PAGES=$(grep -oE "*\/([0-9]{4,})" ./yarnoutput| head -1 | sed 's/\///g')" >> $GITHUB_ENV
- name: Build JSON object
run: |
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/gha-metrics-datadog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Send GHA metrics to Datadog'
on:
workflow_run:
workflows:
- 'Content Release'
types:
- completed
jobs:
send:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
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

# @todo: get Next Build specific API key
- name: Get Datadog api key from Parameter Store
uses: department-of-veterans-affairs/action-inject-ssm-secrets@d8e6de3bde4dd728c9d732baef58b3c854b8c4bb # latest
with:
ssm_parameter: /dsva-vagov/content-build/GHA_CONTENT_BUILD_DATADOG_API_KEY
env_variable_name: GHA_CONTENT_BUILD_DATADOG_API_KEY

- name: Send GitHub Actions metrics to DataDog
uses: int128/datadog-actions-metrics@b55864e8d4ccab2d30f33e9eabc6e02031894555 # v1.97.0
with:
datadog-api-key: ${{ env.GHA_CONTENT_BUILD_DATADOG_API_KEY }}
collect-job-metrics: true
collect-step-metrics: true
datadog-site: ddog-gov.com
2 changes: 1 addition & 1 deletion .github/workflows/mirror-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
echo "IMAGE_TAG=$(cat tag.txt)" >> $GITHUB_ENV
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
if: github.event.deployment_status.state == 'success'
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-region: us-gov-west-1
role-to-assume: ${{ vars.AWS_ASSUME_ROLE }}
Expand Down
Loading

0 comments on commit 1a78e5f

Please sign in to comment.