Skip to content

Commit

Permalink
Upgrade gatsby to latest (#687)
Browse files Browse the repository at this point in the history
* Upgrading `gatsby` to https://github.com/gatsbyjs/gatsby/releases/tag/gatsby%405.14.0

* Break up build and preview steps

* We can still run a build on PR creation

* removing and commenting around lighthouse

* marking deploy as needing to wait on build

* Switching back to a single step
Cleaning up LightHouse stuff

* Only run full builds on non-drafts
Updating how we listen to events

* Want to make sure a build was run first

* Check the same as build

* combining the conditional

* adding ready to review

* Adding logging to the connectors related function

* adding logging for when the logo is found

* making logs simpler as they looked good in the previous build
  • Loading branch information
travjenkins authored Feb 14, 2025
1 parent 33faabf commit 1ae2f44
Show file tree
Hide file tree
Showing 6 changed files with 2,882 additions and 2,980 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,32 @@ name: Deploy to Firebase Preview

on:
pull_request:
label:
types: [created, deleted, edited]
types:
[
opened,
synchronize,
reopened,
labeled,
unlabeled,
ready_for_review,
]

concurrency:
group: preview-${{ github.ref }}

jobs:
build_and_preview:
runs-on: ubuntu-2404-large
if: contains(github.event.pull_request.labels.*.name, 'generate-pr-preview')
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 20
- name: Fetch base_ref HEAD to use it as Ancestor hash in LHCI
run: git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}

- uses: actions/setup-node@v1
with:
node-version: '18.x'

- name: Caching
id: gatsby-cache-build
uses: actions/cache@v4
Expand All @@ -33,16 +39,22 @@ jobs:
key: ${{ runner.os }}-gatsby-build-preview-${{github.head_ref}}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-gatsby-build-preview-${{github.head_ref}}-
- run: yarn install
- run: yarn install --frozen-lockfile

- name: Run ESLint
run: yarn lint
env:
CI: true

- name: Run Prettier
run: yarn format
env:
CI: true
- run: yarn run build --log-pages

- name: Run build
run: yarn run build --log-pages
if: ${{ github.event.pull_request.draft != true }}
env:
CI: true
STRAPI_API_URL: ${{ secrets.STRAPI_API_URL }}
Expand All @@ -52,11 +64,14 @@ jobs:
GATSBY_DB_HOST: ${{ secrets.GATSBY_DB_HOST }}
GATSBY_DB_PORT: ${{ secrets.GATSBY_DB_PORT }}
GATSBY_DB_NAME: ${{ secrets.GATSBY_DB_NAME }}

- uses: FirebaseExtended/action-hosting-deploy@v0
if: ${{ github.event.pull_request.draft != true && contains(github.event.pull_request.labels.*.name, 'generate-pr-preview') }}
id: firebase
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
expires: 15d
projectId: estuary-marketing

- run: echo ${{steps.firebase.outputs.urls}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# We do not use this but just in case someone has it left hanging around
.lighthouseci/

# Runtime data
Expand Down
37 changes: 0 additions & 37 deletions .lighthouserc.js

This file was deleted.

10 changes: 10 additions & 0 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,15 +566,19 @@ export const sourceNodes: GatsbyNode['sourceNodes'] = async ({
getCache,
createContentDigest,
}) => {
console.log('sourceNodes start');
const pool = new pg.Pool({
connectionString: SUPABASE_CONNECTION_STRING,
connectionTimeoutMillis: 5 * 1000,
});

console.log('-fetching start');
const connectors = await pool.query(
'select connectors.id as id, connectors.logo_url as logo_url from public.connectors;'
);
console.log('-fetching done');

console.log('--loop start');
for (const conn of connectors.rows) {
const usUrl = conn.logo_url?.['en-US'];

Expand All @@ -596,10 +600,15 @@ export const sourceNodes: GatsbyNode['sourceNodes'] = async ({
contentDigest: createContentDigest(fileNode),
},
});
} else {
console.error('---no logo', conn.id);
}
}
console.log('--loop done');

await pool.end();

console.log('sourceNodes done');
};

export const createResolvers: GatsbyNode['createResolvers'] = async ({
Expand All @@ -621,6 +630,7 @@ export const createResolvers: GatsbyNode['createResolvers'] = async ({
return logoNode.logo;
}

console.log(' createResolversParam no logo found', id);
return null;
},
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dotenv": "^16.0.3",
"embla-carousel": "^8.2.0",
"embla-carousel-react": "^8.2.0",
"gatsby": "^5.13.3",
"gatsby": "^5.14.0",
"gatsby-image": "^3.11.0",
"gatsby-omni-font-loader": "^2.0.2",
"gatsby-plugin-canonical-urls": "^5.13.1",
Expand Down
Loading

0 comments on commit 1ae2f44

Please sign in to comment.