From 9331a30f2c8d748a968c68ad0c3658ee72a60b0e Mon Sep 17 00:00:00 2001 From: Karol Grochowalski Date: Fri, 17 Nov 2023 15:34:21 +0100 Subject: [PATCH] deployment staging - env patch --- .github/workflows/ci.yml | 3 ++- gatsby-config.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c84c7a..c36ad97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,8 @@ jobs: rm -rf public/blog mkdir -p public/blog find public/ -maxdepth 1 -mindepth 1 -not -name blog -exec mv '{}' public/blog/ \; -# find public/blog -name index.html -exec sed -i 's\window.pagePath="\window.pagePath="/blog\g' {} \; + env: + PATH_PREFIX ${{PATH_PREFIX}} - name: Cloudflare run: | npm install -g @cloudflare/wrangler diff --git a/gatsby-config.js b/gatsby-config.js index 95c5c55..9ff4602 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -4,13 +4,13 @@ require('dotenv').config({ }); module.exports = { - pathPrefix: '/staging-blog', + pathPrefix: process.env.PATH_PREFIX, siteMetadata: { title: 'Flotiq', description: 'Effortless headless CMS', siteUrl: 'https://flotiq.com', // full path to blog - no ending slash apiKey: process.env.SCOPED_FLOTIQ_API_KEY, - pathPrefix: process.env.NODE_ENV === 'production' ? '/staging-blog' : '', + pathPrefix: process.env.NODE_ENV === 'production' ? process.env.PATH_PREFIX : '', }, plugins: [ 'gatsby-plugin-sass', @@ -66,7 +66,7 @@ module.exports = { resolve: 'gatsby-plugin-robots-txt', options: { host: 'https://flotiq.com', - sitemap: 'https://flotiq.com/staging-blog/sitemap.xml', + sitemap: `https://flotiq.com${process.env.PATH_PREFIX}/sitemap.xml`, policy: [{ userAgent: '*', allow: '/' }], }, },