diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 1a630523c1..ff42943aa5 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -23,7 +23,7 @@ jobs: AIRTABLE_MITH_BASE_ID: appMWsw8HKjjokBg2 run: | npm install - npm run build + npm run build-pages - uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/gatsby-config.js b/gatsby-config.js index 419d2c780f..7786e562a6 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,9 +1,10 @@ require("dotenv").config(); const baseId = process.env.AIRTABLE_MITH_BASE_ID; +const basePath = process.env.BASEPATH module.exports = { - pathPrefix: `mith-static`, + pathPrefix: basePath, siteMetadata: { title: `MITH`, siteUrl: "https://mith.umd.edu", diff --git a/gatsby-node.js b/gatsby-node.js index 007bb1f845..ebe17d57d8 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,16 +1,16 @@ const path = require('path') const {createRemoteFileNode} = require('gatsby-source-filesystem') -exports.createPages = async ({ actions: { createPage }, graphql, pathPrefix }) => { - await makePeople(createPage, graphql, pathPrefix) - await makePosts(createPage, graphql, pathPrefix) - await makePostIndex(createPage, graphql, pathPrefix) - await makeResearch(createPage, graphql, pathPrefix) - await makeResearchIndex(createPage, graphql, pathPrefix) - await makeEvents(createPage, graphql, pathPrefix) - await makeEventIndex(createPage, graphql, pathPrefix) - await makeDialogues(createPage, graphql, pathPrefix) - await makeDialogueIndex(createPage, graphql, pathPrefix) +exports.createPages = async ({ actions: { createPage }, graphql }) => { + await makePeople(createPage, graphql) + await makePosts(createPage, graphql) + await makePostIndex(createPage, graphql) + await makeResearch(createPage, graphql) + await makeResearchIndex(createPage, graphql) + await makeEvents(createPage, graphql) + await makeEventIndex(createPage, graphql) + await makeDialogues(createPage, graphql) + await makeDialogueIndex(createPage, graphql) } async function makePeople(createPage, graphql) { @@ -75,7 +75,7 @@ async function makePeople(createPage, graphql) { } } -async function makePosts(createPage, graphql, pathPrefix) { +async function makePosts(createPage, graphql) { const results = await graphql(` query { allFile(filter: {sourceInstanceName: {eq: "news"}}) { @@ -103,7 +103,7 @@ async function makePosts(createPage, graphql, pathPrefix) { } } -async function makePostIndex(createPage, graphql, pathPrefix) { +async function makePostIndex(createPage, graphql) { console.log(`making post index`) const results = await graphql(` query { @@ -133,7 +133,7 @@ async function makePostIndex(createPage, graphql, pathPrefix) { }) } -async function makeResearchIndex(createPage, graphql, pathPrefix) { +async function makeResearchIndex(createPage, graphql) { const results = await graphql(` query { allAirtableResearchItems { @@ -392,7 +392,7 @@ async function makeResearch(createPage, graphql) { } -async function makeEventIndex(createPage, graphql, pathPrefix) { +async function makeEventIndex(createPage, graphql) { const results = await graphql(` query { allAirtableEvents { @@ -696,7 +696,7 @@ async function makeEvents(createPage, graphql) { } -async function makeDialogueIndex(createPage, graphql, pathPrefix) { +async function makeDialogueIndex(createPage, graphql) { const results = await graphql(` query { allAirtableEvents { diff --git a/package.json b/package.json index d5d1dbc0be..903a6e7de0 100644 --- a/package.json +++ b/package.json @@ -10,16 +10,10 @@ "scripts": { "start": "npm run develop", "build": "gatsby build", + "build-pages": "BASEPATH=/mith-static gatsby build --prefix-paths", "develop": "gatsby develop", - "serve": "gatsby serve", "clean": "gatsby clean", - "persist": "node scripts/persist.js", - "compose": "node scripts/compose.js", - "release": "node scripts/release.js", - "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"", - "publish": "gatsby clean && gatsby build && npm run rsync", - "rsync": "rsync --archive --recursive --delete public/ ubuntu@mith.umd.edu:/var/www/mith.umd.edu", - "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1" + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"" }, "repository": { "type": "git",