Skip to content

Commit

Permalink
Update docusaurus to v3 (#2732)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pat-s <patrick.schratz@gmail.com>
  • Loading branch information
3 people authored Nov 5, 2023
1 parent 45a5a2d commit 8946d20
Show file tree
Hide file tree
Showing 17 changed files with 2,120 additions and 433 deletions.
8 changes: 4 additions & 4 deletions docs/docs/20-usage/20-workflow-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Keep in mind the name is optional, if not added the steps will be numerated.

Woodpecker gives the ability to skip individual commits by adding `[SKIP CI]` or `[CI SKIP]` to the commit message. Note this is case-insensitive.

```sh
```bash
git commit -m "updated README [CI SKIP]"
```

Expand Down Expand Up @@ -139,7 +139,7 @@ Commands of every step are executed serially as if you would enter them into you

There is no magic here. The above commands are converted to a simple shell script. The commands in the above example are roughly converted to the below script:

```sh
```bash
#!/bin/sh
set -e
Expand All @@ -149,7 +149,7 @@ go test

The above shell script is then executed as the container entrypoint. The below docker command is an (incomplete) example of how the script is executed:

```sh
```bash
docker run --entrypoint=build.sh golang
```

Expand Down Expand Up @@ -538,7 +538,7 @@ The base attribute defines a shared base volume available to all steps. This ens

This would be equivalent to the following docker commands:

```sh
```bash
docker volume create my-named-volume
docker run --volume=my-named-volume:/go golang:latest
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/20-usage/60-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The below configuration composes database and cache containers.
Services are accessed using custom hostnames.
In the example below, the MySQL service is assigned the hostname `database` and is available at `database:3306`.

```diff
```yaml
steps:
build:
image: golang
Expand Down Expand Up @@ -82,7 +82,7 @@ services:
## Complete Pipeline Example
```yml
```yaml
services:
database:
image: mysql
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/20-usage/90-advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You can use [YAML anchors & aliases](https://yaml.org/spec/1.2.2/#3222-anchors-a

To convert this:

```yml
```yaml
steps:
test:
image: golang:1.18
Expand Down Expand Up @@ -103,7 +103,7 @@ steps:
One can create a file containing environment variables, and then source it in each step that needs them.
```yml
```yaml
steps:
init:
image: bash
Expand All @@ -122,7 +122,7 @@ steps:

As described in [Global environment variables](./50-environment.md#global-environment-variables), one can define global variables:

```yml
```yaml
services:
woodpecker-server:
# ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ You need to trust the external config service as it is getting secret informatio

## Config

```shell
```bash
# Server
# ...
WOODPECKER_CONFIG_SERVICE_ENDPOINT=https://example.com/ciconfig
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/30-administration/11-forges/20-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Woodpecker comes with built-in support for GitHub and GitHub Enterprise.
To use Woodpecker with GitHub the following environment variables should be set for the server component:

```sh
```bash
WOODPECKER_GITHUB=true
WOODPECKER_GITHUB_CLIENT=YOUR_GITHUB_CLIENT_ID
WOODPECKER_GITHUB_SECRET=YOUR_GITHUB_CLIENT_SECRET
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/30-administration/22-backends/10-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ The following commands **are destructive** and **irreversible** it is highly rec

### Remove all unused images

```sh
```bash
docker image rm $(docker images --filter "dangling=true" -q --no-trunc)
```

### Remove Woodpecker Volumes

```sh
```bash
docker volume rm $(docker volume ls --filter name=^wp_* --filter dangling=true -q)
```
5 changes: 2 additions & 3 deletions docs/docs/30-administration/22-backends/20-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ In the context of the local backend, plugins are simply executable binaries, whi

### Using labels to filter tasks

You can use the [agent configuration
options](../15-agent-config.md#woodpecker_filter_labels) and the
[pipeline syntax](../../20-usage/20-workflow-syntax.md#labels) to only run certain
You can use the [agent configuration options](../15-agent-config.md#woodpecker_filter_labels)
and the [pipeline syntax](../../20-usage/20-workflow-syntax.md#labels) to only run certain
pipelines on certain agents. Example:

Define a `label` `type` with value `exec` for a particular agent:
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/30-administration/22-backends/40-kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The kubernetes backend executes steps inside standalone pods. A temporary PVC is
These env vars can be set in the `env:` sections of both `server` and `agent`.
They do not need to be set for both but only for the part to which it is relevant to.

```yml
```yaml
server:
env:
WOODPECKER_SESSION_EXPIRES: "300h"
Expand Down Expand Up @@ -56,7 +56,7 @@ We recommend to add a `resources` definition to all steps to ensure efficient sc

Here is an example definition with an arbitrary `resources` definition below the `backend_options` section:

```yml
```yaml
steps:
'My kubernetes step':
image: alpine
Expand Down Expand Up @@ -90,7 +90,7 @@ To overwrite this, one needs to set the label in the `nodeSelector` section of t
A practical example for this is when running a matrix-build and delegating specific elements of the matrix to run on a specific architecture.
In this case, one must define an arbitrary key in the matrix section of the respective matrix element:

```yml
```yaml
matrix:
include:
- NAME: runner1
Expand All @@ -99,7 +99,7 @@ matrix:

And then overwrite the `nodeSelector` in the `backend_options` section of the step(s) using the name of the respective env var:

```yml
```yaml
[...]
backend_options:
kubernetes:
Expand Down Expand Up @@ -164,7 +164,7 @@ steps:

CRI-O users currently need to configure the workspace for all workflows in order for them to run correctly. Add the following at the beginning of your configuration:

```yml
```yaml
workspace:
base: '/woodpecker'
path: '/'
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/30-administration/40-encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ to use while encrypting new data.

Keyset generation example:

```shell
```bash
tinkey create-keyset --key-template AES256_GCM --out-format json --out keyset.json
```

### Key rotation

Use `tinkey` to rotate encryption keys in your existing keyset:

```shell
```bash
tinkey rotate-keyset --in keyset_v1.json --out keyset_v2.json --key-template AES256_GCM
```

Expand Down
4 changes: 2 additions & 2 deletions docs/docs/30-administration/70-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This guide provides a brief overview for installing Woodpecker server behind the Apache2 web-server. This is an example configuration:

```nohighlight
```apacheconf
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
Expand Down Expand Up @@ -112,7 +112,7 @@ Set `WOODPECKER_HOST` (for example in `docker-compose.yml`) to the ngrok URL (us

To install the Woodpecker server behind a [Traefik](https://traefik.io/) load balancer, you must expose both the `http` and the `gRPC` ports. Here is a comprehensive example, considering you are running Traefik with docker swarm and want to do TLS termination and automatic redirection from http to https.

```yml
```yaml
version: '3.8'

services:
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/92-development/08-swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ More enhanced information you can find here <https://github.com/swaggo/swag/blob

#### generate the server's Go code containing the Swagger

```shell
```bash
make generate-swagger
```

##### update the Markdown in the ./docs folder

```shell
```bash
make docs
```

##### auto-format swagger related godoc

```shell
```bash
go run github.com/swaggo/swag/cmd/swag@latest fmt -g server/api/z.go
```

Expand Down
25 changes: 15 additions & 10 deletions docs/docusaurus.config.js → docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const codeThemes = require('prism-react-renderer').themes;
const path = require('path');
import { themes } from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import * as path from 'path';

/** @type {import('@docusaurus/types').Config} */
module.exports = {
const config: Config = {
title: 'Woodpecker CI',
tagline: 'Woodpecker is a simple CI engine with great extensibility.',
url: 'https://woodpecker-ci.org',
Expand All @@ -14,7 +15,6 @@ module.exports = {
projectName: 'woodpecker-ci.github.io',
trailingSlash: false,
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'Woodpecker',
Expand Down Expand Up @@ -137,8 +137,9 @@ module.exports = {
copyright: `Copyright © ${new Date().getFullYear()} Woodpecker CI. Built with Docusaurus.`,
},
prism: {
theme: codeThemes.github,
darkTheme: codeThemes.dracula,
theme: themes.github,
darkTheme: themes.dracula,
additionalLanguages: ['diff', 'json', 'docker', 'javascript', 'css', 'bash', 'nginx', 'apacheconf'],
},
announcementBar: {
id: 'github-star',
Expand All @@ -153,7 +154,7 @@ module.exports = {
colorMode: {
respectPrefersColorScheme: true,
},
}),
} satisfies Preset.ThemeConfig),
plugins: [
() => ({
name: 'docusaurus-plugin-favicon',
Expand Down Expand Up @@ -205,7 +206,6 @@ module.exports = {
presets: [
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
Expand Down Expand Up @@ -235,7 +235,7 @@ module.exports = {
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
} satisfies Preset.Options),
],
[
'redocusaurus',
Expand Down Expand Up @@ -264,4 +264,9 @@ module.exports = {
},
}),
},
markdown: {
format: 'detect'
}
};

export default config;
26 changes: 17 additions & 9 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^2.4.1",
"@docusaurus/preset-classic": "^2.4.1",
"@docusaurus/core": "^3.0.0",
"@docusaurus/preset-classic": "^3.0.0",
"@easyops-cn/docusaurus-search-local": "^0.36.0",
"@mdx-js/react": "^1.6.22",
"@mdx-js/react": "^3.0.0",
"@svgr/webpack": "^8.0.0",
"clsx": "^2.0.0",
"esbuild-loader": "^4.0.0",
"file-loader": "^6.2.0",
"prism-react-renderer": "^2.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"redocusaurus": "^1.6.3",
"prism-react-renderer": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"redocusaurus": "^2.0.0",
"url-loader": "^4.1.1"
},
"browserslist": {
Expand All @@ -41,8 +41,10 @@
]
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.1",
"@tsconfig/docusaurus": "^2.0.0",
"@docusaurus/module-type-aliases": "^3.0.0",
"@docusaurus/tsconfig": "3.0.0",
"@docusaurus/types": "^3.0.0",
"@types/node": "^20.0.0",
"@types/react": "^18.2.31",
"@types/react-helmet": "^6.1.6",
"@types/react-router-dom": "^5.3.3",
Expand All @@ -53,5 +55,11 @@
"trim": "^0.0.3",
"got": "^11.8.5"
}
},
"overrides": {
"@easyops-cn/docusaurus-search-local": {
"@docusaurus/core": "^3.0.0",
"@docusaurus/theme-common": "^3.0.0"
}
}
}
6 changes: 3 additions & 3 deletions docs/plugins/woodpecker-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"style": "mkdir -p dist/theme/ && cp src/theme/style.css dist/theme/style.css"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.1",
"@docusaurus/theme-classic": "^2.4.1",
"@docusaurus/types": "^2.4.1",
"@docusaurus/module-type-aliases": "^3.0.0",
"@docusaurus/theme-classic": "^3.0.0",
"@docusaurus/types": "^3.0.0",
"@tsconfig/docusaurus": "^2.0.0",
"@types/marked": "^5.0.0",
"@types/node": "^20.0.0",
Expand Down
Loading

0 comments on commit 8946d20

Please sign in to comment.