From 594777baedad2f26547af7f776cb80bfb4e6e70c Mon Sep 17 00:00:00 2001 From: Radu Dumitrescu Date: Fri, 9 Feb 2024 11:40:22 +0200 Subject: [PATCH] wip ci cd --- .github/workflows/dev-docs.yml | 78 ++++++++++++++++++ docusaurus.config.js | 141 ++++++++++++++++----------------- genezio.yaml | 10 +-- 3 files changed, 151 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/dev-docs.yml diff --git a/.github/workflows/dev-docs.yml b/.github/workflows/dev-docs.yml new file mode 100644 index 00000000..f1abfc7a --- /dev/null +++ b/.github/workflows/dev-docs.yml @@ -0,0 +1,78 @@ +# Sample workflow for building and deploying a Hugo site to GitHub Pages +name: Deploy Hugo site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["migrate-to-docusaurus"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +# Default to bash +defaults: + run: + shell: bash + +jobs: + # Build job + deploy: + runs-on: ubuntu-latest + env: + HUGO_VERSION: 0.120.4 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: Genez-io/genezio-github-action@main + with: + token: ${{ secrets.GENEZIO_TOKEN }} + - name: Install Hugo CLI + run: | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ + && sudo dpkg -i ${{ runner.temp }}/hugo.deb + - name: Install Dart Sass + run: sudo snap install dart-sass + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install Docs Node.js dependencies + run: npm ci + - name: Build Docs + run: npm run build + - name: Clone Repo https://github.com/Genez-io/genezio-landing-page/ + run: git clone https://github.com/Genez-io/genezio-landing-page/ + - name: Build with Hugo + env: + # For maximum backward compatibility with Hugo modules + HUGO_ENVIRONMENT: production + HUGO_ENV: production + run: | + cd genezio-landing-page + git checkout dev + hugo \ + --minify \ + --baseURL "${{ steps.pages.outputs.base_url }}/" + - name: Copy public folder + run: cp -r genezio-landing-page/public/ public/ + - name: Copy build files to /public/docs + run: | + mkdir -p public/docs/ + cp -r build/* public/docs/ + - name: Deploy deploy + working-directory: ./ + run: genezio deploy --frontend --stage dev diff --git a/docusaurus.config.js b/docusaurus.config.js index 1fd3583e..1c9a7763 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -16,7 +16,7 @@ const config = { url: "https://genezio.com", // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: "/", + baseUrl: "/docs/", // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. @@ -31,7 +31,7 @@ const config = { // may want to replace "en" with "zh-Hans". i18n: { defaultLocale: "en", - locales: ["en"], + locales: ["en"] }, plugins: ["plugin-image-zoom"], @@ -39,85 +39,84 @@ const config = { [ "classic", /** @type {import('@docusaurus/preset-classic').Options} */ - ({ + { docs: { sidebarPath: "./sidebars.js", routeBasePath: "/", // Please change this to your repo. // Remove this to remove the "edit this page" links., - include: ["**/*.md", "**/.*.md"], // Include dot files + include: ["**/*.md", "**/.*.md"] // Include dot files }, blog: false, theme: { - customCss: "./src/css/custom.css", - }, - }), - ], + customCss: "./src/css/custom.css" + } + } + ] ], - themeConfig: - /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ - ({ - // Replace with your project's social card - image: "img/genezio.svg", - navbar: { - title: "Genezio Documentation", - logo: { - alt: "Genezio Logo", - src: "img/favicon.ico", - srcDark: "img/genezio.svg", - }, - }, - // footer: { - // style: "dark", - // links: [ - // { - // title: "Docs", - // items: [ - // { - // label: "Tutorial", - // to: "/docs/intro", - // }, - // ], - // }, - // { - // title: "Community", - // items: [ - // { - // label: "Stack Overflow", - // href: "https://stackoverflow.com/questions/tagged/docusaurus", - // }, - // { - // label: "Discord", - // href: "https://discordapp.com/invite/docusaurus", - // }, - // { - // label: "Twitter", - // href: "https://twitter.com/docusaurus", - // }, - // ], - // }, - // { - // title: "More", - // items: [ - // { - // label: "Blog", - // to: "/blog", - // }, - // { - // label: "GitHub", - // href: "https://github.com/facebook/docusaurus", - // }, - // ], - // }, - // ], - // copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, - // }, - prism: { - theme: prismThemes.oneLight, - darkTheme: prismThemes.dracula, - }, - }), + /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ + themeConfig: { + // Replace with your project's social card + image: "img/genezio.svg", + navbar: { + title: "Genezio Documentation", + logo: { + alt: "Genezio Logo", + src: "img/favicon.ico", + srcDark: "img/genezio.svg" + } + }, + // footer: { + // style: "dark", + // links: [ + // { + // title: "Docs", + // items: [ + // { + // label: "Tutorial", + // to: "/docs/intro", + // }, + // ], + // }, + // { + // title: "Community", + // items: [ + // { + // label: "Stack Overflow", + // href: "https://stackoverflow.com/questions/tagged/docusaurus", + // }, + // { + // label: "Discord", + // href: "https://discordapp.com/invite/docusaurus", + // }, + // { + // label: "Twitter", + // href: "https://twitter.com/docusaurus", + // }, + // ], + // }, + // { + // title: "More", + // items: [ + // { + // label: "Blog", + // to: "/blog", + // }, + // { + // label: "GitHub", + // href: "https://github.com/facebook/docusaurus", + // }, + // ], + // }, + // ], + // copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`, + // }, + prism: { + theme: prismThemes.oneLight, + darkTheme: prismThemes.dracula + } + } }; export default config; diff --git a/genezio.yaml b/genezio.yaml index 21ecd567..9bd8243a 100644 --- a/genezio.yaml +++ b/genezio.yaml @@ -1,9 +1,5 @@ -name: genezio-docs +name: genezio-landing-page region: us-east-1 -cloudProvider: genezio -# scripts: -# preFrontendDeploy: npm install && npm run build frontend: - path: ./build - subdomain: genezio-docs -packageManager: npm \ No newline at end of file + path: ./public + subdomain: genezio-landing-page