Skip to content

Commit

Permalink
Drinkery commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tmanundercover committed Aug 11, 2023
1 parent 9766f63 commit 847f7a2
Show file tree
Hide file tree
Showing 23 changed files with 619 additions and 35 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,38 @@ name: Deploy to Firebase Hosting on merge
'on':
push:
branches:
- master
- master

jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci && tsc && yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
- name: Checking out code
uses: actions/checkout@v2
- name: Setting up CI Env variables
run: |
set -e
# Put your environment variables here. Don't forget
# to create secrets for them on GitHub:
# https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
cat << EOF > .env
REACT_APP_SANITY_PROJECTID="${{ secrets.REACT_APP_SANITY_PROJECTID }}"
REACT_APP_SANITY_DB="${{ secrets.REACT_APP_SANITY_DB }}"
REACT_APP_API_KEY="${{ secrets.REACT_APP_API_KEY }}"
REACT_APP_AUTH_DOMAIN="${{ secrets.REACT_APP_AUTH_DOMAIN }}"
REACT_APP_PROJECT_ID="${{ secrets.REACT_APP_PROJECT_ID }}"
REACT_APP_STORAGE_BUCKET="${{ secrets.REACT_APP_STORAGE_BUCKET }}"
REACT_APP_MESSAGING_SENDER_ID="${{ secrets.REACT_APP_MESSAGING_SENDER_ID }}"
REACT_APP_APP_ID="${{ secrets.REACT_APP_APP_ID }}"
REACT_APP_FIREBASE_ANALYTICS_TRACKING_ID="${{ secrets.REACT_APP_FIREBASE_ANALYTICS_TRACKING_ID }}"
EOF
- name: Building production code
run: unset CI && npm ci && npm run build

- name: Deploying to Firebase Hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_THE_HANDSOMEST_NERD }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_ST_JOSEPH_FWBC }}'
channelId: live
projectId: transform-hw
projectId: st-joseph-fwbc
20 changes: 16 additions & 4 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npm ci && tsc && yarn build
- uses: FirebaseExtended/action-hosting-deploy@v0
- name: Creating env file
run: |
set -e
# Put your environment variables here. Don't forget
# to create secrets for them on GitHub:
# https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
cat << EOF > .env.production
REACT_APP_SANITY_PROJECTID="${{ secrets.REACT_APP_SANITY_PROJECTID }}"
REACT_APP_SANITY_DB="${{ secrets.REACT_APP_SANITY_DB }}"
EOF
- name: Building code
run: unset CI && npm ci && npm run build
- name: Deploying to hosting
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_THE_HANDSOMEST_NERD }}'
projectId: transform-hw
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_ST_JOSEPH_FWBC }}'
projectId: st-joseph-fwbc
36 changes: 36 additions & 0 deletions .github/workflows/sanity-backup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Backup Sanity db
on:
schedule:
# Runs at 04:00 UTC on the 1st and 17th of every month
- cron: '0 4 */16 * *'
workflow_dispatch:


jobs:
export_upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: |
cd sanityIo
npm install
set -e
# Put your environment variables here. Don't forget
# to create secrets for them on GitHub:
# https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
cat << EOF > .env.production
EOF
# Make sure to add a secret for SANITY_AUTH_TOKEN
SANITY_AUTH_TOKEN="${{ secrets.SANITY_AUTH_TOKEN }}" npx @sanity/cli dataset export production backups/backup.tar.gz
- name: Upload backup.tar.gz
uses: actions/upload-artifact@v3
with:
name: backup-tarball
path: sanityIo/backups/backup.tar.gz
# Fails the workflow if no files are found; defaults to 'warn'
if-no-files-found: error
7 changes: 7 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"name": "functions",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "tsc && npm run html",
"build": "tsc",
"build:dev": "NODE_ENV=development tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "npm run build && firebase deploy --only functions",
"logs": "firebase functions:log",
"html": "mv ../build/index.html ./lib/functions/src"
"html": "cp ../build/index.html ./lib/functions/src"
},
"engines": {
"node": "14"
Expand Down Expand Up @@ -44,7 +44,7 @@
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"firebase-functions-test": "^0.2.0",
"typescript": "^4.8.4"
"typescript": "^5.1.3"
},
"private": true
}
10 changes: 5 additions & 5 deletions functions/src/cmsClient.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {log} from "./logClient";
import {sanityClient} from "./sanityClient";
import {SanityColdLead, SanityTransformHwHomePage} from "../../src/common/sanityIo/Types";
import groqQueries from "../../src/utils/groqQueries";
// import {SanityColdLead, SanityTransformHwHomePage} from "../../src/common/sanityIo/Types";
import groqQueries from "./groqQueries";

const createColdLead = async (coldLead: SanityColdLead) => {
const createColdLead = async (coldLead: any) => {
log("createSanityColdLead", "DEBUG", "creating cold lead ", coldLead.email);

const newColdLead: SanityColdLead = {
const newColdLead: any = {
...coldLead,
};

Expand All @@ -27,7 +27,7 @@ const fetchPage = async (pageSlug:string)=>{
`*[slug.current == $pageSlug]{
${groqQueries.HOMEPAGE}
}`, {pageSlug})
.then((data: SanityTransformHwHomePage[]) => {
.then((data:any) => {
log("fetchPage", "NOTICE", "fetched page", {pageSlug, page: data[0]});
return data[0];
})
Expand Down
171 changes: 171 additions & 0 deletions functions/src/groqQueries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
const MENUGROUP = `
title,
_type,
slug,
menuGroupTitle,
"links":links[]->{
_type,
displayText,
url,
isOutlinedButton,
isContainedButton,
isModalButton,
modalRef->{
name,
title,
slug,
backgroundImageSrc,
iconOverlayImageSrc,
"contentText":contentText[],
"notes":notes[],
ctaButtonTitle,
ctaButtonLink
}
},
displayText,
url,
isOutlinedButton,
isContainedButton,
`;

const MENUGROUPCONTAINER = `
title,
slug,
displayText,
"subMenus":subMenus[]->{
${MENUGROUP}
},
logoImageSrc,
logoImageAltText
`;

const SERVICE =
`name,
imageSrc,
imageSrcAltText,
contentTitle,
contentText,
ctaButtonText,
ctaButtonLink,
learnMoreLink,
learnMoreText,
educationPageTitle,
educationPageSlimHeroImage,
extendedDescriptions,
benefitsOfServiceTitle,
benefitsOfServiceContents,
benefitsOfServiceBullets,
"serviceAmenities": serviceAmenities[]->,
slug,`;


const HOMEPAGE = `_type,
title,
isUnderConstruction,
releaseDate,
slug,
address,
email,
phone,
description,
businessCardImageSrc,
bookAppointmentLink,
bookAppointmentQrCode,
website,
websiteQrCode,
metaImage,
headerContent {
"content": content[]->{
...,
headerMenuRef->{
${MENUGROUPCONTAINER}
},
}
},
footerContent {
"content": content[]->{
...,
footerMenuRef->{
${MENUGROUPCONTAINER}
},
}
},
pageContent {
"content": content[]->{
...,
"servicesList": servicesList[]->{
${SERVICE}
},
"serviceAmenities": serviceAmenities[]->,
"skillsets": skillsets[]{
...,
"skills": skills[]->{
_id,
name,
title,
},
},
"experiences": experiences[]->{
...,
"skillsUsed": skillsUsed[]->
},
"educationExperiences": educationExperiences[]->,
"feedbackEntries": feedbackEntries[]->,
"portfolioEntries": portfolioEntries[]->{
...,
"skillsHighlighted": skillsHighlighted[]->,
"imageGallery": imageGallery[]
},
"resumeFile": resumeFile.asset->,
"cvFile": cvFile.asset->
}
},
"servicesAvailable": servicesAvailable[]->{
${SERVICE}
},
underConstructionPageRef,
structuredData,
facebook,
facebookIconSrc{
asset->{
_id,
url,
altText
}
},
twitter,
twitterIconSrc{
asset->{
_id,
url,
altText
}
},
instagram,
linkedIn,
github,
instagramIconSrc{
asset->{
_id,
url,
altText
}
}
`;
// const MENUGROUP = `
// title,
// slug,
// logoImage,
// menuGroupTitle,
// "links": links[]->{title, displayText, url, isOutlinedButton, isContainedButton}
// `


enum SANITY_TYPES_ENUM {
SERVICE="transformServiceItem"
}

const defaultObj = {HOMEPAGE, MENUGROUPCONTAINER, MENUGROUP, SERVICE, SANITY_TYPES_ENUM};


export default defaultObj;
Loading

0 comments on commit 847f7a2

Please sign in to comment.