From 5edbec3ffd6309c98b9775b34a0badf361fd1066 Mon Sep 17 00:00:00 2001 From: nfpappas-oddball Date: Wed, 2 Oct 2024 15:38:17 -0400 Subject: [PATCH 1/3] Do not require a sitemap.xml to exist and create an empty sitemap if none exists do to feature flags --- .github/workflows/content-release.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/content-release.yml b/.github/workflows/content-release.yml index 9a145dfb4..7a45ff9cc 100644 --- a/.github/workflows/content-release.yml +++ b/.github/workflows/content-release.yml @@ -209,23 +209,31 @@ jobs: run: | cd main && yarn build:sitemap cd out - cp sitemap.xml sitemap-nb.xml + if [ -f sitemap.xml ]; then + echo "File found!" + cp sitemap.xml sitemap-nb.xml + fi + if [! -f sitemap.xml ]; then + echo "File Not found!" + touch sitemap-nb.xml + fi + - name: setup bucket descriptor id: bucket-descriptor run: | if [ "${{ inputs.build_type }}" == 'dev' ]; then - echo NEXT_SITEMAP_LOCATION="https://s3.us-gov-west-1.amazonaws.com/next-content.dev.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT - echo OLD_SITEMAP_LOCATION="https://s3.us-gov-west-1.amazonaws.com/content.dev.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + 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://s3.us-gov-west-1.amazonaws.com/next-content.staging.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT - echo OLD_SITEMAP_LOCATION="https://s3.us-gov-west-1.amazonaws.com/content.staging.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + 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://s3.us-gov-west-1.amazonaws.com/next-content.www.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT - echo OLD_SITEMAP_LOCATION="https://s3.us-gov-west-1.amazonaws.com/next-content.www.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + 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://s3.us-gov-west-1.amazonaws.com/next-content.www.va.gov/sitemap-nb.xml" >> $GITHUB_OUTPUT - echo OLD_SITEMAP_LOCATION="https://s3.us-gov-west-1.amazonaws.com/next-content.www.va.gov/sitemap-cb.xml" >> $GITHUB_OUTPUT + 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 From 63ce7a4c9828b397b91e290de5a9b602a360e428 Mon Sep 17 00:00:00 2001 From: nfpappas-oddball Date: Wed, 2 Oct 2024 16:15:39 -0400 Subject: [PATCH 2/3] modify if else to be compliant with the unix flavor on the github runner --- .github/workflows/content-release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/content-release.yml b/.github/workflows/content-release.yml index 7a45ff9cc..001517e17 100644 --- a/.github/workflows/content-release.yml +++ b/.github/workflows/content-release.yml @@ -212,11 +212,10 @@ jobs: if [ -f sitemap.xml ]; then echo "File found!" cp sitemap.xml sitemap-nb.xml - fi - if [! -f sitemap.xml ]; then - echo "File Not found!" + else touch sitemap-nb.xml fi + - name: setup bucket descriptor From d1aea32a1695df3dfa7c81a5b2c9a6b109fa4266 Mon Sep 17 00:00:00 2001 From: nfpappas-oddball Date: Wed, 2 Oct 2024 16:47:26 -0400 Subject: [PATCH 3/3] add shell argument and fix indentation --- .github/workflows/content-release.yml | 35 ++++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/content-release.yml b/.github/workflows/content-release.yml index 3cecd389b..66ac3842e 100644 --- a/.github/workflows/content-release.yml +++ b/.github/workflows/content-release.yml @@ -215,24 +215,25 @@ jobs: 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: 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: |