From 202a0e5d8b5b225d5ce089990c888aaae8ee1edd Mon Sep 17 00:00:00 2001 From: pookmish Date: Mon, 15 Jul 2024 15:04:26 -0700 Subject: [PATCH] Updated github actions and gitpod (#14) --- .github/workflows/build_lint.yml | 13 ++--- .gitpod.yml | 54 +++++++++---------- src/components/elements/headers.tsx | 8 +-- .../stanford-banner/banner-paragraph.tsx | 2 +- 4 files changed, 34 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build_lint.yml b/.github/workflows/build_lint.yml index 854a8f69..719d0df3 100644 --- a/.github/workflows/build_lint.yml +++ b/.github/workflows/build_lint.yml @@ -33,6 +33,7 @@ jobs: image: pookmish/drupal8ci:latest env: BUILD_PAGES: 100 + SITENAME: sitedir services: mysql: image: mysql:5.7 @@ -45,13 +46,6 @@ jobs: - 33306:3306 options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: -# - name: Install SSH key -# uses: shimataro/ssh-key-action@v2 -# with: -# key: ${{ secrets.SSH_KEY }} -# name: id_rsa -# known_hosts: ${{ secrets.KNOWN_HOSTS }} -# if_key_exists: fail - uses: actions/checkout@v4 with: repository: "SU-SWS/ace-stanfordlagunita" @@ -80,11 +74,10 @@ jobs: ln -snf $GITHUB_WORKSPACE /var/www/html && mkdir -p docroot/sites/default/files && chmod -R 777 docroot/sites/default/files/ && - rm -rf docroot/sites/summer/files && - ln -sL ../default/files/ docroot/sites/summer/files && apachectl stop && apachectl start && composer install -n && - blt drupal:install -n + blt drupal:install -n && + drush sqlq 'truncate config_pages__su_site_algolia_id' - name: Build Frontend run: | cd $GITHUB_WORKSPACE/frontend && diff --git a/.gitpod.yml b/.gitpod.yml index 3f1a7839..fc44b3fd 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,6 +1,6 @@ additionalRepositories: - - url: https://github.com/SU-SWS/acsf-cardinalsites-public + - url: https://github.com/SU-SWS/ace-stanfordlagunita/ checkoutLocation: back checkoutLocation: front ports: @@ -19,7 +19,7 @@ ports: visibility: public - name: frontend description: NextJS frontend - port: 3000 + port: 3000-3004 onOpen: ignore visibility: public - port: 8002-9999 @@ -28,46 +28,47 @@ image: pookmish/drupal8ci:gitpod tasks: - name: Drupal Prep init: > + eval $(gp env -e SITENAME=default) && eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) && cd /workspace/back && - rm -rf config/default && - mkdir -p config/default && - touch config/default/core.extension.yml && + git checkout 2.x && composer install --no-interaction && mkdir -p blt && cp .gitpod/blt.yml blt/local.blt.yml && find docroot/sites/ -name 'local*' | xargs rm -rf && - cp .gitpod/global.settings.php docroot/sites/settings/global.settings.php && - cp .gitpod/default.local.services.yml docroot/sites/local.services.yml && export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` && export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} && blt blt:telemetry:disable --no-interaction && blt settings && - blt drupal:install -n && - drush cset system.theme default claro -y && + echo 'ssh: {options: "-o StrictHostKeyChecking=no"}' > drush/local.drush.yml && + if [[ ! -z $SSH_PRIVATE_KEY ]]; then + echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa && + blt drupal:sync --site=$SITENAME -n || blt drupal:install --site=$SITENAME -n + else + blt drupal:install --site=$SITENAME -n + fi && + drush @$SITENAME.local cset system.theme default stanford_profile_admin_theme -y && cd /workspace/front && yarn command: | cp .env.example .env.local && - cd /workspace/back && - echo 'Restarting Apache' && + gp ports await 3306 && eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) && - apache2ctl restart && - gp ports await 8001 && - find docroot -name 'local.drush.yml' | xargs rm && + cd /workspace/back && export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` && export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} && - blt blt:telemetry:disable --no-interaction && - echo 'Establishing Settings' && + echo " docroot/sites/local.sites.php && blt settings && - echo 'Logging Into Drupal' && - drush uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL && - drush uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL | xargs gp preview --external && + apache2ctl restart && + gp ports await 8001 && + drush @$SITENAME.local uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL && + drush @$SITENAME.local uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL | xargs gp preview --external && git config core.fileMode false && - echo 'Connecting Drupal to Frontend' && - drush su-next-connect "$(gp url 3000)" >> /workspace/front/.env.local && + drush @$SITENAME.local su-next-connect "$(gp url 3000)" >> /workspace/front/.env.local && cd /workspace/front && - yarn && + yarn install && + yarn config set --home enableTelemetry 0 && + yarn next telemetry disable && sed -i -r "s|NEXT_PUBLIC_DRUPAL_BASE_URL.*|NEXT_PUBLIC_DRUPAL_BASE_URL=$NEXT_PUBLIC_DRUPAL_BASE_URL|g" .env.local && yarn dev & gp ports await 3000 && @@ -76,17 +77,14 @@ tasks: before: | code --add /workspace/back && mkdir -p ~/.ssh - if [[ ! -z $SSH_PUBLIC_KEY ]]; then - echo $SSH_PUBLIC_KEY | base64 -d > ~/.ssh/id_rsa.pub && chmod 644 ~/.ssh/id_rsa.pub - git remote set-url origin $(echo $GITPOD_WORKSPACE_CONTEXT | jq -r .repository.cloneUrl | sed -E 's|^.*.com/(.*)$|git@github.com:\1|') - fi if [[ ! -z $SSH_PRIVATE_KEY ]]; then - echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa && + git remote set-url origin $(echo $GITPOD_WORKSPACE_CONTEXT | jq -r .repository.cloneUrl | sed -E 's|^.*.com/(.*)$|git@github.com:\1|') && + cd /workspace/back && git remote set-url origin git@github.com:SU-SWS/ace-stanfordlagunita.git fi if [[ ! -z $GITCONFIG ]]; then echo $GITCONFIG | base64 -d > ~/.gitconfig && chmod 644 ~/.gitconfig fi - git remote set-url origin $(echo $GITPOD_WORKSPACE_CONTEXT | jq -r .repository.cloneUrl | sed -E 's|^.*.com/(.*)$|git@github.com:\1|') vscode: extensions: diff --git a/src/components/elements/headers.tsx b/src/components/elements/headers.tsx index 47d5fbb4..851ef0db 100644 --- a/src/components/elements/headers.tsx +++ b/src/components/elements/headers.tsx @@ -7,7 +7,7 @@ const headingLinkClasses = "[&_a]:text-digital-red [&_a]:hocus:text-black [&_a]: export const H1 = ({children, className, ...props}: Props) => { return ( -

+

{children}

) @@ -15,7 +15,7 @@ export const H1 = ({children, className, ...props}: Props) => { export const H2 = ({children, className, ...props}: Props) => { return ( -

+

{children}

) @@ -23,7 +23,7 @@ export const H2 = ({children, className, ...props}: Props) => { export const H3 = ({children, className, ...props}: Props) => { return ( -

+

{children}

) @@ -31,7 +31,7 @@ export const H3 = ({children, className, ...props}: Props) => { export const H4 = ({children, className, ...props}: Props) => { return ( -

+

{children}

) diff --git a/src/components/paragraphs/stanford-banner/banner-paragraph.tsx b/src/components/paragraphs/stanford-banner/banner-paragraph.tsx index 1d96181a..889f0661 100644 --- a/src/components/paragraphs/stanford-banner/banner-paragraph.tsx +++ b/src/components/paragraphs/stanford-banner/banner-paragraph.tsx @@ -39,7 +39,7 @@ const BannerParagraph = ({paragraph, eagerLoadImage, ...props}: Props) => { {paragraph.suBannerHeader && ( <> {headerTag === "h2" && ( -

+

{paragraph.suBannerHeader}

)}