Skip to content

Commit

Permalink
prod deployment (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolzhabayev authored Aug 11, 2023
1 parent a7159c1 commit 0075a55
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/deploy-to-developer-portal-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy to Developer Portal PROD Bucket

on:
push:
branches:
- main
paths:
- '.github/workflows/deploy-to-developer-portal-prod.yml'
- 'docusaurus/**'
jobs:
deploy:
name: Deploy docs to Developer Portal Bucket
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'

- name: Install dependencies
run: npm ci

#mac: sed -i '' 's/title: Get started/title: Get started\nslug:\ \//g' ./docusaurus/docs/get-started/get-started.mdx
#mac: grep -rl "](/docs/" docusaurus/docs | xargs sed -i '' 's/](\/docs\//](\//g'
#linux: sed -i 's/title: Get started/title: Get started\nslug:\ \//g' ./docusaurus/docs/get-started/get-started.mdx
#linux: grep -rl "](/docs/" docusaurus/docs | xargs sed -i 's/](\/docs\//](\//g'
- name: Make docs the homepage of this subsite
run: |
rm -f ./docusaurus/website/src/pages/index.tsx
sed -i 's/title: Get started/title: Get started\nslug:\ \//g' ./docusaurus/docs/get-started/get-started.mdx
grep -rl "](/docs/" docusaurus/docs | xargs sed -i 's/](\/docs\//](\//g'
- name: Build documentation website
run: npm run docs:build -- --config docusaurus.config.devportal.prod.js

- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Deploy to Developer Portal Bucket
uses: google-github-actions/upload-cloud-storage@v1
with:
path: './docusaurus/website/build/'
destination: 'grafana-developer-portal/plugin-tools'
parent: false
67 changes: 67 additions & 0 deletions docusaurus/website/docusaurus.config.devportal.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const {
generalConfig,
plugins,
presetsDocs,
presetsTheme,
themeConfigNavbar,
themeConfigFooter,
themeConfigPrism,
themeConfigColorMode,
} = require('./docusaurus.config.base');


// Replace docs link in footer so builds don't have broken links.
const [docs, ...rest] = themeConfigFooter.links;
const footerConfig = {
...themeConfigFooter,
links: [
{
title: 'Docs',
items: [
{
label: 'Get Started',
to: '/',
},
],
},
...rest,
],
};

/** @type {import('@docusaurus/types').Config} */
const config = {
...generalConfig,
url: 'https://grafana.com/',
baseUrl: 'developers/plugin-tools/',

plugins: plugins,

presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
...presetsDocs,
routeBasePath: '/',
},
theme: presetsTheme,
blog: false,
}),
],
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: themeConfigNavbar,
footer: footerConfig,
prism: themeConfigPrism,
colorMode: themeConfigColorMode,
}),
};

module.exports = config;

0 comments on commit 0075a55

Please sign in to comment.