diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml deleted file mode 100644 index 8d690148..00000000 --- a/.github/workflows/doc.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Doc - -on: - push: - paths: - - 'doc/**' - -jobs: - copy-file: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Pushes docs file - uses: slumbering/copy_file_to_another_repo_action@main - env: - API_TOKEN_GITHUB: ${{ secrets.DAGGERCI_TOKEN }} - with: - source_file: 'doc/' - destination_repo: 'dagger/launch.dagger.io' - destination_folder: 'site/' - user_email: 'noreply@dagger.io' - user_name: 'dagger-bot' diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..9674dac8 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,78 @@ +name: Docs + +on: + push: + branches: + - main + tags: + - v* + paths: + - "docs/**" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + env: + AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: "eu-east-1" + + steps: + - name: Set Tag Name + id: vars + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + + # fetch-depth: '0' enables listing all tags for version selector + - uses: actions/checkout@v2 + with: + fetch-depth: "0" + + ################################################################# + # BUILD SITE + ################################################################# + + # Install Node + - uses: actions/setup-node@v2 + with: + node-version: "14" + - run: yarn --cwd ./tools/gendocs + - name: Build Site + run: yarn --cwd ./tools/gendocs build --prefix-paths + env: + VERSION: ${{steps.vars.outputs.tag}} + + ################################################################# + # DEPLOY TO S3 + ################################################################# + + # deploy the site in the right foder ( tag or main) + - name: S3 Sync + uses: ItsKarma/aws-cli@v1.70.0 + with: + args: s3 sync --delete ./tools/gendocs/public/ s3://docs.dagger.io/${{steps.vars.outputs.tag}}/ + + # list All Tags in json file for version selector + # upload to /tags.json + - name: Create tags.json + run: echo "[" {\"tag\"':' \"$(git tag -l "v*" | tr '\n' '|' | sed -e 's/|/"}, {\"tag\"':' "/g')main\"} "]" > tags.json + - name: Copy tags.json + uses: ItsKarma/aws-cli@v1.70.0 + with: + args: s3 cp ./tags.json s3://docs.dagger.io/ + + # landing alway on latest tag + # use S3 Rediret objet + # upload to /docs/index.html + - run: touch index.html + - name: Redirect Latest tag on landing + # FIXME + # if: ${{ steps.vars.outputs.tag != 'main' }} + uses: ItsKarma/aws-cli@v1.70.0 + with: + # FIXME: `--website-redirect` uses a permanent redirect, therefore if + # we use the latest version it will be in cache forever. + # args: s3 cp --cache-control max-age=0 --website-redirect /docs/${{steps.vars.outputs.tag}}/ ./index.html s3://docs.dagger.io/docs/ + args: s3 cp --cache-control max-age=0 --website-redirect /main/ ./index.html s3://docs.dagger.io/ diff --git a/doc/01_overview.md b/docs/index.md similarity index 100% rename from doc/01_overview.md rename to docs/index.md diff --git a/doc/install.md b/docs/install.md similarity index 100% rename from doc/install.md rename to docs/install.md diff --git a/doc/operator.md b/docs/operator.md similarity index 100% rename from doc/operator.md rename to docs/operator.md diff --git a/doc/programming.md b/docs/programming.md similarity index 100% rename from doc/programming.md rename to docs/programming.md diff --git a/docs/sidebar/sidebar.yml b/docs/sidebar/sidebar.yml new file mode 100644 index 00000000..e4ac6701 --- /dev/null +++ b/docs/sidebar/sidebar.yml @@ -0,0 +1,32 @@ +# Sidebar navigation + +- label: 'Install deploy' + link: '/install' + +- label: 'Operator' + link: '/operator' + +- label: 'Programming' + link: '/programming' + +- label: 'VS' + link: '/vs' + +- label: 'Getting started' + link: '/getting-started' + +- label: Usage + items: + - label: 'Creating docs' + link: '/usage/creating-docs' + - label: 'Navigation' + link: '/usage/navigation' + - label: 'Shadowing' + link: '/usage/shadowing' + +- label: More + items: + - label: FAQ + link: /faq + - label: 'Github' + link: https://github.com/dagger/dagger diff --git a/doc/vs.md b/docs/vs.md similarity index 100% rename from doc/vs.md rename to docs/vs.md diff --git a/tools/gendocs/.gitignore b/tools/gendocs/.gitignore new file mode 100644 index 00000000..542ebfb2 --- /dev/null +++ b/tools/gendocs/.gitignore @@ -0,0 +1,71 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# dotenv environment variable files +.env* + +# gatsby files +.cache/ +public + +# Mac files +.DS_Store + +# Yarn +yarn-error.log +.pnp/ +.pnp.js +# Yarn Integrity file +.yarn-integrity + +.idea/ diff --git a/tools/gendocs/LICENSE b/tools/gendocs/LICENSE new file mode 100644 index 00000000..e74feb36 --- /dev/null +++ b/tools/gendocs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Rocketseat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/gendocs/README.md b/tools/gendocs/README.md new file mode 100644 index 00000000..9dcc6808 --- /dev/null +++ b/tools/gendocs/README.md @@ -0,0 +1,61 @@ +

+ A illustration of file that is the @rocketseat/gatsby-theme-docs logo +

+ +

+ Gatsby Starter: Rocket Docs +

+ +

+ Out of the box Gatsby Starter for creating documentation websites easily and quickly. With support for MDX, code highlight, Analytics, SEO and more πŸ”₯ Using the theme: @rocketseat/gatsby-theme-docs +

+ +

+ PRs welcome! + + License + + + Follow @rocketseat + +

+ +## πŸš€ Features + +- πŸ“ MDX for docs; +- πŸ›£ Yaml-based sidebar navigation; +- πŸ“± Responsive and mobile friendly; +- πŸ–₯ Code highlighting with [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) and [react-live](https://github.com/FormidableLabs/react-live) support; +- πŸ₯‡ SEO (Sitemap, schema.org data, Open Graph and Twitter tags). +- πŸ“ˆ Google Analytics support; +- πŸ“„ Custom docs schema; +- πŸ–± Table of Contents; +- ⚑️ Offline Support & WebApp Manifest; +- and much more πŸ”₯ + +## ⚑️ Getting started + +1. Create the website. + + ```sh + npx gatsby new rocket-docs https://github.com/rocketseat/gatsby-starter-rocket-docs + ``` + +2. Start developing. + + ```sh + cd rocket-docs + gatsby develop + ``` + +3. Are you ready for launch? + + Your site is now running at `http://localhost:8000` + +## πŸ“„ Docs + +Looking for docs? Check our live demo and documentation [website](https://rocketdocs.netlify.app). + +--- + +Made with πŸ’œ by Rocketseat :wave: [check our community!](https://discordapp.com/invite/gCRAFhc) diff --git a/tools/gendocs/docs b/tools/gendocs/docs new file mode 120000 index 00000000..92a7f825 --- /dev/null +++ b/tools/gendocs/docs @@ -0,0 +1 @@ +../../docs \ No newline at end of file diff --git a/tools/gendocs/gatsby-config.js b/tools/gendocs/gatsby-config.js new file mode 100644 index 00000000..74f783b3 --- /dev/null +++ b/tools/gendocs/gatsby-config.js @@ -0,0 +1,28 @@ +module.exports = { + pathPrefix: `/${process.env.VERSION}`, + siteMetadata: { + siteTitle: `Dagger Docs`, + defaultTitle: `Dagger Docs`, + siteTitleShort: `Dagger Docs`, + siteDescription: `Dagger Documentation`, + siteUrl: `https://launch.dagger.io`, + siteAuthor: `@dagger`, + siteImage: `/banner.png`, + siteLanguage: `en`, + themeColor: `#1890FF`, + docVersion : `${process.env.VERSION}`, + }, + flags: { PRESERVE_WEBPACK_CACHE: true }, + plugins: [ + { + resolve: `@rocketseat/gatsby-theme-docs`, + options: { + basePath: `/`, + configPath: `docs/sidebar`, + docsPath: `docs`, + repositoryUrl: `https://github.com/dagger/dagger`, + baseDir: `/`, + }, + }, + ], +}; diff --git a/tools/gendocs/package.json b/tools/gendocs/package.json new file mode 100644 index 00000000..aef687f0 --- /dev/null +++ b/tools/gendocs/package.json @@ -0,0 +1,34 @@ +{ + "name": "dagger-docs", + "private": true, + "version": "1.0.0", + "description": "dagger dc", + "author": "Dagger", + "license": "MIT", + "starter-name": "dagger-docs-generator", + "dependencies": { + "@rocketseat/gatsby-theme-docs": "^2.3.1", + "gatsby": "^3.0.4", + "gatsby-plugin-canonical-urls": "^3.0.0", + "gatsby-plugin-google-analytics": "^3.0.0", + "gatsby-plugin-manifest": "^3.0.0", + "gatsby-plugin-offline": "^4.0.0", + "gatsby-plugin-remove-trailing-slashes": "^3.0.0", + "gatsby-plugin-sitemap": "^3.0.0", + "prop-types": "^15.7.2", + "react": "^17.0.1", + "react-dom": "^17.0.1" + }, + "devDependencies": {}, + "keywords": [ + "gatsby", + "rocketseat", + "gatsby-starter" + ], + "scripts": { + "build": "gatsby build", + "start": "gatsby develop", + "serve": "gatsby serve", + "clean": "gatsby clean" + } +} diff --git a/tools/gendocs/src/@rocketseat/gatsby-theme-docs/assets/dagger-logo.jpg b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/assets/dagger-logo.jpg new file mode 100644 index 00000000..eb586635 Binary files /dev/null and b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/assets/dagger-logo.jpg differ diff --git a/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Logos.js b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Logos.js new file mode 100644 index 00000000..1e5a3126 --- /dev/null +++ b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Logos.js @@ -0,0 +1,6 @@ +import React from 'react'; +import logo from '../assets/dagger-logo.jpg' + +export default function Logo(props) { + return Logo +} \ No newline at end of file diff --git a/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/ExternalLink/index.js b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/ExternalLink/index.js new file mode 100644 index 00000000..dcbad43c --- /dev/null +++ b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/ExternalLink/index.js @@ -0,0 +1,19 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FiExternalLink } from 'react-icons/fi'; + +export default function ExternalLink({ link, label }) { + return ( + + {label} + + + ); +} + +ExternalLink.propTypes = { + link: PropTypes.string.isRequired, + label: PropTypes.string.isRequired, +}; diff --git a/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/InternalLink/index.js b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/InternalLink/index.js new file mode 100644 index 00000000..f951b77f --- /dev/null +++ b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/InternalLink/index.js @@ -0,0 +1,17 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import {Link} from 'gatsby'; + +export default function InternalLink({ link, label }) { + + return ( + + {label} + + ); +} + +InternalLink.propTypes = { + link: PropTypes.string.isRequired, + label: PropTypes.string.isRequired, +}; diff --git a/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/Select/index.js b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/Select/index.js new file mode 100644 index 00000000..bcab8dba --- /dev/null +++ b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/Select/index.js @@ -0,0 +1,28 @@ +import React, { useEffect, useState } from "react"; +import { Select as SelectStyled } from '../styles'; + +const Select = () => { + const isBrowser = typeof window !== "undefined" + const [tagsList, setTagsList] = useState([]) + const currentLocation = isBrowser ? window.location.pathname.split('/') : [] + currentLocation.pop() //remove last trailing slash + + useEffect(() => { + async function getTags() { + const fetchTags = await fetch('https://s3-eu-west-1.amazonaws.com/daggerdoc.humans-it.com/tags.json').then(result => result.json()); + setTagsList(fetchTags); + } + + getTags() + }, []) + + return ( + isBrowser ? window.location.pathname = `/${e.currentTarget.value}/index.html` : null}> + {tagsList.map(t => ( + + ))} + + ); +}; + +export default Select; diff --git a/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/index.js b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/index.js new file mode 100644 index 00000000..e1aff7fe --- /dev/null +++ b/tools/gendocs/src/@rocketseat/gatsby-theme-docs/components/Sidebar/index.js @@ -0,0 +1,95 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { useStaticQuery, graphql, Link } from 'gatsby'; +import { useSidebar } from '@rocketseat/gatsby-theme-docs-core'; + +import { + Container, + LogoContainer, + List, + Heading, + Item, + SubItem, +} from './styles'; +import Select from './Select' +import { isExternalUrl } from '../../util/url'; +import ExternalLink from './ExternalLink'; +import InternalLink from './InternalLink'; +import Logo from '../Logos'; + +function ListWithSubItems({ children, text }) { + return ( + <> + {text} + {children} + + ); +} + +export default function Sidebar({ isMenuOpen }) { + const { + site: { + siteMetadata: { basePath }, + }, + } = useStaticQuery(graphql` + { + site { + siteMetadata { + basePath + } + } + } + `); + + const data = useSidebar(); + + function renderLink(link, label) { + return isExternalUrl(link) ? ( + + ) : ( + + ); + } + + return ( + + + + +