diff --git a/.github/workflows/deploy-to-developer-portal-dev.yml b/.github/workflows/deploy-to-developer-portal-dev.yml index f63e768..3f3d54e 100644 --- a/.github/workflows/deploy-to-developer-portal-dev.yml +++ b/.github/workflows/deploy-to-developer-portal-dev.yml @@ -34,7 +34,7 @@ jobs: sed -i '1s/^/---\nslug: \/\n---\n/' ./docs/contract/contract.md - name: Build documentation website - run: yarn docs:build:devportal + run: yarn docs:build:devportal:dev - id: 'auth' uses: 'google-github-actions/auth@v1' diff --git a/.github/workflows/deploy-to-developer-portal-prod.yml b/.github/workflows/deploy-to-developer-portal-prod.yml new file mode 100644 index 0000000..67f2a47 --- /dev/null +++ b/.github/workflows/deploy-to-developer-portal-prod.yml @@ -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/**" + - "docs/**" +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: 'yarn' + + - name: Install dependencies + run: yarn install --immutable --prefer-offline + + #mac: sed -i '' '1s/^/---\nslug: \/\n---\n/' ./docs/contract/contract.md + #linux: sed -i '1s/^/---\nslug: \/\n---\n/' ./docs/contract/contract.md + - name: Make docs the homepage of this subsite + run: | + rm -f ./docusaurus/website/src/pages/index.tsx + sed -i '1s/^/---\nslug: \/\n---\n/' ./docs/contract/contract.md + + - name: Build documentation website + run: yarn docs:build:devportal:prod + + - 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/dataplane' + parent: false diff --git a/docusaurus/website/docusaurus.config.devportal.prod.js b/docusaurus/website/docusaurus.config.devportal.prod.js new file mode 100644 index 0000000..bdf854e --- /dev/null +++ b/docusaurus/website/docusaurus.config.devportal.prod.js @@ -0,0 +1,135 @@ +// @ts-check +// Note: type annotations allow type checking and IDEs autocompletion + +const lightCodeTheme = require("prism-react-renderer/themes/github"); +const darkCodeTheme = require("prism-react-renderer/themes/dracula"); +// const remark = require("remark"); +// const stripHTML = require("remark-strip-html"); + +/** @type {import('@docusaurus/types').Config} */ +const config = { + title: "Grafana Data Plane", + tagline: "A contract of data types as the source of truth", + url: "https://grafana.com/", + baseUrl: "developers/dataplane/", + onBrokenLinks: "throw", + onBrokenMarkdownLinks: "warn", + favicon: "img/favicon.png", + organizationName: "grafana", + projectName: "dataplane", + i18n: { + defaultLocale: "en", + locales: ["en"], + }, + plugins: [], + presets: [ + [ + "classic", + /** @type {import('@docusaurus/preset-classic').Options} */ + ({ + docs: { + routeBasePath: "/", + path: "../../docs/contract", + sidebarPath: require.resolve("./sidebars.js"), + // Please change this to your repo. + // Remove this to remove the "edit this page" links. + editUrl: + "https://github.com/grafana/dataplane/edit/main/docusaurus/website", + }, + theme: { + customCss: require.resolve("./src/css/custom.css"), + }, + blog: false, + }), + ], + ], + + themeConfig: + /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ + ({ + navbar: { + title: "Grafana Data Plane", + logo: { + alt: "Grafana Logo", + src: "img/logo.svg", + }, + items: [ + { + type: "doc", + docId: "contract", + position: "right", + label: "Contract", + }, + { + href: "https://www.github.com/grafana/dataplane", + label: "GitHub", + position: "right", + }, + ], + }, + footer: { + style: "dark", + links: [ + { + title: "Docs", + items: [ + { + label: "Contract", + to: "/", + }, + ], + }, + { + title: "Tools & Examples", + items: [ + { + label: "Mock Data Source Plugin", + href: "https://grafana.com/plugins/grafana-mock-datasource", + }, + { + label: "Example Data Frames (JSON)", + href: "https://github.com/grafana/dataplane/tree/main/examples/data", + }, + { + label: "Go Testing/Example Library", + href: "https://pkg.go.dev/github.com/grafana/dataplane/examples", + }, + { + label: "Go Dataplane Library", + href: "https://pkg.go.dev/github.com/grafana/dataplane/sdata", + }, + ], + }, + { + title: "Other Resources", + items: [ + { + label: "Go Plugin Data Package", + href: "hhttps://pkg.go.dev/github.com/grafana/grafana-plugin-sdk-go/data", + } + ], + }, + { + title: "Community", + items: [ + { + label: "GitHub", + href: "https://www.github.com/grafana/dataplane", + }, + { + label: "Github Issues", + href: "https://www.github.com/grafana/dataplane/issues", + }, + ], + }, + ], + copyright: `Copyright © ${new Date().getFullYear()} Grafana Labs. Built with Docusaurus.`, + }, + prism: { + theme: lightCodeTheme, + darkTheme: darkCodeTheme, + }, + }), +}; + +module.exports = config; \ No newline at end of file diff --git a/package.json b/package.json index 7825da2..9f6e909 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "scripts": { "spellcheck": "cspell -c cspell.config.json \"**/*.{ts,tsx,js,go,md,mdx,yml,yaml,json,scss,css}\"", "docs:build": "turbo docs:build", - "docs:build:devportal": "turbo docs:build -- --config=docusaurus.config.devportal.js", + "docs:build:devportal:dev": "turbo docs:build -- --config=docusaurus.config.devportal.js", + "docs:build:devportal:prod": "turbo docs:build -- --config=docusaurus.config.devportal.prod.js", "test:backend": "turbo test:backend", "test": "turbo test:backend" },