Skip to content

Commit

Permalink
Merge 64be454 into 5100320
Browse files Browse the repository at this point in the history
  • Loading branch information
luizbafilho committed Feb 1, 2022
2 parents 5100320 + 64be454 commit 53fc259
Show file tree
Hide file tree
Showing 459 changed files with 44,829 additions and 1 deletion.
135 changes: 135 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Docs

on:
pull_request:
branches:
- 'main'
paths:
- 'website/**'
push:
branches:
- 'main'
paths:
- 'website/**'

jobs:
update-doc-repo-files:
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: |
git fetch --prune --unshallow
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: Create GitOps binary
run: |
make all
- name: Set up environment vars
run: |
echo "BRANCH=release-doc-updates-$$" >> $GITHUB_ENV
echo "GITOPS_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Update with new version
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
GA_KEY: "dummy"
run: |
bash tools/update-docs.sh ${PWD}/bin/gitops ${PWD}/website
- name: Git diff
run: |
git diff
- name: Delete version
run: |
version=$(cat -p website/versions.json|jq -r '. | last')
rm -rf website/versioned_docs/version-$version
- name: Create Pull Request
uses: peter-evans/create-pull-request@9825ae65b1cb54b543b938503728b432a0176d29 # v3
with:
token: ${{ secrets.WEAVE_GITOPS_DOCS_WEAVEWORKS_DOCS_BOT_PAT }}
committer: GitHub <noreply@github.com>
author: weave-test-user <weave-test-user@example.com>
signoff: true
branch: ${{ env.BRANCH }}
base: add-docs
draft: true
title: "Documentation updates for ${{ env.GITOPS_VERSION }}"
body: "Update version references to ${{ env.GITOPS_VERSION }} and create new versioned documentation set."
staging-release:
if: github.event_name != 'push'
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e
- uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d
with:
node-version: "14.x"
- name: Test Build
env:
GA_KEY: "dummy"
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
- id: auth
uses: google-github-actions/auth@v0.4.0
with:
credentials_json: ${{ secrets.PROD_DOCS_GITOPS_UPLOAD }}
- id: upload-file
uses: google-github-actions/upload-cloud-storage@v0.4.0
with:
path: website/build
destination: staging.docs.gitops.weave.works
parent: false
prod-release:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e
- uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d
with:
node-version: "14.x"
- uses: weaveworks/webfactory-ssh-agent@6b2f2c5354ff41f1edbbf7a17ea9b6178c89be9f
with:
ssh-private-key: ${{ secrets.WEAVE_GITOPS_DOCS_WEAVEWORKS_DOCS_BOT_DEPLOY_KEY }}
- name: Release to GitHub Pages
env:
USE_SSH: true
GIT_USER: git
GA_KEY: ${{ secrets.GA_KEY }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
run: |
git config --global user.email "corporate-it+weaveworks-docs-bot@weave.works"
git config --global user.name "weaveworks-docs-bot"
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
npm run build
- id: auth
uses: google-github-actions/auth@v0.4.0
with:
credentials_json: ${{ secrets.PROD_DOCS_GITOPS_UPLOAD }}
- id: upload-file
uses: google-github-actions/upload-cloud-storage@v0.4.0
with:
path: website/build
destination: production.docs.gitops.weave.works
parent: false
2 changes: 1 addition & 1 deletion tools/update-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ git add *.md
# create versioned docs
cd $WEAVE_GITOPS_DOC_REPO
version_number=$(cut -f2 -d'v' <<< $GITOPS_VERSION)
npm run docusaurus docs:version $version_number
npm run docusaurus docs:version 0.6.3
20 changes: 20 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
35 changes: 35 additions & 0 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

## Installation

```console
yarn install
```

## Local Development

Set a fake Algolia API key to pass validation errors:

```shell
export ALGOLIA_API_KEY=fakekey
```

```console
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## Build

```console
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## Deployment

Deployment happens automatically (once the tests pass) upon merging to the default branch: see [.github/workflows/documentation.yml](.github/workflows/documentation.yml) for config.
3 changes: 3 additions & 0 deletions website/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
32 changes: 32 additions & 0 deletions website/docs/_components/TierLabel.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import Link from "@docusaurus/Link";
import useGlobalData from "@docusaurus/useGlobalData";

const containerStyle = {
fontSize: 16,
marginLeft: 4,
fontVariant: "all-small-caps",
};

// This determines the current version of the docs you're looking at
// E.g. /docs/next or /docs/0.2.5
const getCurrentVersionPath = () => {
const { "docusaurus-plugin-content-docs": data } = useGlobalData();
const currentVersion = data?.default?.versions?.find(
(v) => v.name === "current"
);
// Fallback to /docs just in case. Not sure if this is async etc.
return currentVersion?.path || "/docs";
};

export default function TierLabel({ tiers }) {
return (
<Link
to={`${getCurrentVersionPath()}/enterprise/intro`}
title={`This feature is a available on ${tiers}`}
style={containerStyle}
>
{tiers}
</Link>
);
}
8 changes: 8 additions & 0 deletions website/docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
sidebar_position: 4
---

# Architecture

Coming soon

Loading

0 comments on commit 53fc259

Please sign in to comment.