Skip to content

Commit

Permalink
Support Staging Site For Docs (#41)
Browse files Browse the repository at this point in the history
* Staging Docs site changes

* Admin Key added for algolia

* dummy commit

* Staging CD branch changed to dev

* CI Variables added
  • Loading branch information
PratheepV authored Sep 9, 2022
1 parent 5ee38bb commit 34ca689
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'CD'
on:
push:
branches:
- 'dev'
- 'main'
jobs:
Deploy:
runs-on: ubuntu-latest
Expand All @@ -25,6 +25,13 @@ jobs:
echo GATSBY_ALGOLIA_APP_ID=${{ secrets.GATSBY_ALGOLIA_APP_ID }} >> .env
echo GATSBY_ALGOLIA_SEARCH_KEY=${{ secrets.GATSBY_ALGOLIA_SEARCH_KEY }} >> .env
echo ALGOLIA_ADMIN_KEY=${{ secrets.ALGOLIA_ADMIN_KEY }} >> .env
echo BUCKET_NAME=${{ secrets.BUCKET_NAME }} >> .env
echo HOST_NAME=${{ secrets.HOST_NAME }} >> .env
echo ASSET_HOST=${{ secrets.ASSET_HOST }} >> .env
echo FRESHCHAT_TOKEN=${{ secrets.FRESHCHAT_TOKEN }} >> .env
echo GA_TRACKING_ID=${{ secrets.GA_TRACKING_ID }} >> .env
echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.GTAG_TRACKING_ID_FOR_GA4 }} >> .env
echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.GTAG_TRACKING_ID_FOR_GTAG }} >> .env
cat .env
- name: Build
run: |
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ jobs:
echo GATSBY_ALGOLIA_APP_ID=${{ secrets.GATSBY_ALGOLIA_APP_ID }} >> .env
echo GATSBY_ALGOLIA_SEARCH_KEY=${{ secrets.GATSBY_ALGOLIA_SEARCH_KEY }} >> .env
echo ALGOLIA_ADMIN_KEY=${{ secrets.ALGOLIA_ADMIN_KEY }} >> .env
echo BUCKET_NAME=${{ secrets.BUCKET_NAME }} >> .env
echo HOST_NAME=${{ secrets.HOST_NAME }} >> .env
echo ASSET_HOST=${{ secrets.ASSET_HOST }} >> .env
echo FRESHCHAT_TOKEN=${{ secrets.FRESHCHAT_TOKEN }} >> .env
echo GA_TRACKING_ID=${{ secrets.GA_TRACKING_ID }} >> .env
echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.GTAG_TRACKING_ID_FOR_GA4 }} >> .env
echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.GTAG_TRACKING_ID_FOR_GTAG }} >> .env
cat .env
- name: Build
run: |
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/staging-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Staging CD'
on:
push:
branches:
- 'dev'
jobs:
StagingDeploy:
runs-on: ubuntu-latest
steps:
- name: Install libvips
run: sudo apt-get install libvips
- uses: actions/checkout@v2
- name: Setup Node 12
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Install dependencies
run: |
npm ci --ignore-scripts --unsafe-perm
- name: Force installing sharp
run: npm install --ignore-scripts=false --verbose [email protected]
- name: 'Create env file'
run: |
touch .env
echo GATSBY_ALGOLIA_APP_ID=${{ secrets.STAGING_GATSBY_ALGOLIA_APP_ID }} >> .env
echo GATSBY_ALGOLIA_SEARCH_KEY=${{ secrets.STAGING_GATSBY_ALGOLIA_SEARCH_KEY }} >> .env
echo ALGOLIA_ADMIN_KEY=${{ secrets.STAGING_ALGOLIA_ADMIN_KEY }} >> .env
echo BUCKET_NAME=${{ secrets.STAGING_BUCKET_NAME }} >> .env
echo HOST_NAME=${{ secrets.STAGING_HOST_NAME }} >> .env
echo ASSET_HOST=${{ secrets.STAGING_ASSET_HOST }} >> .env
echo FRESHCHAT_TOKEN=${{ secrets.STAGING_FRESHCHAT_TOKEN }} >> .env
echo GA_TRACKING_ID=${{ secrets.STAGING_GA_TRACKING_ID }} >> .env
echo GTAG_TRACKING_ID_FOR_GA4=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GA4 }} >> .env
echo GTAG_TRACKING_ID_FOR_GTAG=${{ secrets.STAGING_GTAG_TRACKING_ID_FOR_GTAG }} >> .env
cat .env
- name: Build
run: |
PREFIX_PATHS=true npm run build && npm run deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
AWS_DEFAULT_OUTPUT: json
14 changes: 7 additions & 7 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const queries = [


module.exports = {
assetPrefix: `https://d3qczh57rxoojd.cloudfront.net`,
assetPrefix: process.env.ASSET_HOST,
siteMetadata: {
title: 'Testsigma Documentation',
description: '',
Expand Down Expand Up @@ -132,9 +132,9 @@ module.exports = {
{
resolve: `gatsby-plugin-s3`,
options: {
bucketName: "docs.testsigma.com",
bucketName: process.env.BUCKET_NAME,
protocol: "https",
hostname: "testsigma.com/docs/",
hostname: process.env.HOST_NAME,
generateRedirectObjectsForPermanentRedirects: true
},
},
Expand All @@ -160,14 +160,14 @@ module.exports = {
{
resolve: `gatsby-plugin-freshchat`,
options: {
token: "b905859c-c256-471f-ab0a-a4d0829d27ee", // process.env.FRESHCHAT_TOKEN,
token: process.env.FRESHCHAT_TOKEN,
host: "https://wchat.freshchat.com",
},
},
{
resolve: `gatsby-plugin-google-analytics`,
options: {
trackingId: "UA-99606664-1",
trackingId: process.env.GA_TRACKING_ID,
head: false,
anonymize: true,
respectDNT: true,
Expand All @@ -178,8 +178,8 @@ module.exports = {
resolve: `gatsby-plugin-google-gtag`,
options: {
trackingIds: [
"G-ZE2Z1J3VPK", // Google Analytics 4
"AW-777462306", // Google Tag Manager
process.env.GTAG_TRACKING_ID_FOR_GA4, // Google Analytics 4
process.env.GTAG_TRACKING_ID_FOR_GTAG, // Google Tag Manager
],
pluginConfig: {
head: false,
Expand Down

0 comments on commit 34ca689

Please sign in to comment.