diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..9d053638 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +# .github/workflows/release.yml +name: Release + +on: + pull_request: + types: [closed] + +jobs: + build: + runs-on: ubuntu-latest + permissions: write-all + if: github.event.pull_request.merged + steps: + - name: Get Next Release + id: tag + uses: K-Phoen/semver-release-action@master + with: + release_strategy: none + release_branch: main + tag_format: "%major%.%minor%.%patch%" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: echo 'Creating new release for ' ${{ steps.tag.outputs.tag }} + - name: Create Release + if: ${{ steps.tag.outputs.tag }} + uses: ncipollo/release-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: ${{ steps.tag.outputs.tag }} + tag: ${{ steps.tag.outputs.tag }} + commit: ${{ github.sha }} + generateReleaseNotes: true + makeLatest: true + diff --git a/README.md b/README.md index 88aae7ea..944a8a0a 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ To learn more about Next.js, take a look at the following resources: You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! -## Deploy on Vercel +## Deploy on Vercel (main) The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. diff --git a/app/api/revalidate/route.tsx b/app/api/revalidate/route.tsx index c4e690df..5ed4d7ae 100644 --- a/app/api/revalidate/route.tsx +++ b/app/api/revalidate/route.tsx @@ -4,7 +4,7 @@ import {getEntityFromPath} from "@lib/gql/gql-queries" export const revalidate = 0 -const getHomePagePath = nextCache( +export const getHomePagePath = nextCache( async () => { const {entity} = await getEntityFromPath("/") return entity?.path diff --git a/app/sitemap.tsx b/app/sitemap.tsx index 1a3b72b9..be3153f5 100644 --- a/app/sitemap.tsx +++ b/app/sitemap.tsx @@ -1,9 +1,10 @@ import {MetadataRoute} from "next" import {graphqlClient} from "@lib/gql/gql-client" import {NodeUnion} from "@lib/gql/__generated__/drupal" +import {getHomePagePath} from "./api/revalidate/route" // https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config -export const revalidate = 25200 +export const revalidate = 604800 export const dynamic = "force-static" const Sitemap = async (): Promise => { @@ -15,9 +16,10 @@ const Sitemap = async (): Promise => { const sitemap: MetadataRoute.Sitemap = [] + const homePath = await getHomePagePath() nodes.map(node => sitemap.push({ - url: `https://summer.stanford.edu${node.path}`, + url: `https://summer.stanford.edu` + (homePath === node.path ? "/" : node.path), lastModified: new Date(node.changed.time), priority: node.__typename === "NodeStanfordPage" ? 1 : 0.8, changeFrequency: node.__typename === "NodeStanfordPage" ? "weekly" : "monthly",