From d84490a0df308f0783637e39bf5302128f9f8584 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Wed, 11 Jul 2018 16:43:33 +0200 Subject: [PATCH] Replaced docker docs with netlify deployment (#4420) --- .drone.yml | 26 ++++++------------------- docs/Dockerfile | 22 --------------------- docs/config.yaml | 16 +++++++-------- docs/docker/caddy.conf | 44 ------------------------------------------ docs/static/.gitkeep | 0 docs/static/_headers | 6 ++++++ docs/static/_redirects | 8 ++++++++ 7 files changed, 28 insertions(+), 94 deletions(-) delete mode 100644 docs/Dockerfile delete mode 100644 docs/docker/caddy.conf delete mode 100644 docs/static/.gitkeep create mode 100644 docs/static/_headers create mode 100644 docs/static/_redirects diff --git a/.drone.yml b/.drone.yml index d9bccddca..d7226bd6a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -203,7 +203,7 @@ pipeline: when: event: [ push, tag ] - build_docs: + build-docs: image: webhippie/hugo:latest pull: true commands: @@ -212,26 +212,12 @@ pipeline: - make clean - make build - docker_docs: - image: plugins/docker:17.05 + publish-docs: + image: lucap/drone-netlify:latest pull: true - secrets: [ docker_username, docker_password ] - repo: gitea/docs - context: docs - dockerfile: docs/Dockerfile - tags: [ '${DRONE_BRANCH##release/v}' ] - when: - event: [ push ] - branch: [ release/* ] - - docker_docs: - image: plugins/docker:17.05 - pull: true - secrets: [ docker_username, docker_password ] - repo: gitea/docs - context: docs - dockerfile: docs/Dockerfile - tags: [ 'latest' ] + secrets: [ netlify_token ] + site_id: 05515f14-3702-4a84-9ff3-88ba90fe08dd + path: docs/public/ when: event: [ push ] branch: [ master ] diff --git a/docs/Dockerfile b/docs/Dockerfile deleted file mode 100644 index c69a9214e..000000000 --- a/docs/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -# build stage -FROM golang:alpine AS build-env - -RUN apk add --no-cache git -RUN go get -d -v github.com/mholt/caddy/caddy github.com/pedronasser/caddy-search github.com/simia-tech/caddy-locale -WORKDIR /go/src/github.com/mholt/caddy/caddy - -RUN sed -i '/This is where other plugins get plugged in (imported)/a _ "github.com/pedronasser/caddy-search"' caddymain/run.go \ - && sed -i '/This is where other plugins get plugged in (imported)/a _ "github.com/simia-tech/caddy-locale"' caddymain/run.go \ - && go install -v . \ - && /go/bin/caddy -version - -FROM alpine:edge -EXPOSE 80 - -RUN apk add --no-cache wget mailcap ca-certificates -COPY --from=build-env /go/bin/caddy /usr/sbin/caddy - -COPY docker/caddy.conf /etc/caddy.conf -COPY public /srv/www - -CMD ["/usr/sbin/caddy", "-conf", "/etc/caddy.conf"] diff --git a/docs/config.yaml b/docs/config.yaml index 7fb8c9824..b963894c8 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -31,7 +31,7 @@ menu: post: active - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: Blog url: https://blog.gitea.io/ @@ -79,7 +79,7 @@ languages: post: active - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: 博客 url: https://blog.gitea.io/ @@ -122,7 +122,7 @@ languages: post: active - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: 部落格 url: https://blog.gitea.io/ @@ -165,7 +165,7 @@ languages: post: active - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: Blog url: https://blog.gitea.io/ @@ -208,7 +208,7 @@ languages: post: active - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: Blog url: https://blog.gitea.io/ @@ -241,17 +241,17 @@ languages: menu: page: - name: Site - url: /fr-fr/ + url: https://gitea.io/en-us/ weight: 10 pre: home post: active - name: Documentation - url: https://docs.gitea.io/fr-fr/ + url: /fr-fr/ weight: 20 pre: question - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: Blog url: https://blog.gitea.io/ diff --git a/docs/docker/caddy.conf b/docs/docker/caddy.conf deleted file mode 100644 index 6e90e41d6..000000000 --- a/docs/docker/caddy.conf +++ /dev/null @@ -1,44 +0,0 @@ -:80 { - root /srv/www - - locale en-US zh-CN zh-TW pt-BR nl-NL fr-FR { - detect header - } - - redir 301 { - if {path} match ^/$ - / /{>Detected-Locale}/ - } - - rewrite /en-US/ { - regexp (.*) - to /en-us/{1} - } - - rewrite /zh-CN/ { - regexp (.*) - to /zh-cn/{1} - } - - rewrite /zh-TW/ { - regexp (.*) - to /zh-tw/{1} - } - - rewrite /pt-BR/ { - regexp (.*) - to /pt-br/{1} - } - - rewrite /nl-NL/ { - regexp (.*) - to /nl-nl/{1} - } - - rewrite /fr-FR/ { - regexp (.*) - to /fr-fr/{1} - } - - header / Vary "Accept-Language" -} diff --git a/docs/static/.gitkeep b/docs/static/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/docs/static/_headers b/docs/static/_headers new file mode 100644 index 000000000..b3c268ea1 --- /dev/null +++ b/docs/static/_headers @@ -0,0 +1,6 @@ +/* + Content-Security-Policy: default-src 'self' + X-Frame-Options: DENY + X-Xss-Protection: 1; mode=block + X-Content-Type-Options: nosniff + Referrer-Policy: strict-origin-when-cross-origin diff --git a/docs/static/_redirects b/docs/static/_redirects new file mode 100644 index 000000000..0eb23153a --- /dev/null +++ b/docs/static/_redirects @@ -0,0 +1,8 @@ +https://gitea-docs.netlify.com/* https://docs.gitea.io/:splat 302! + +/ /fr-fr/ 302! Language=fr +/ /nl-nl/ 302! Language=nl +/ /pt-br/ 302! Language=pt-br +/ /zh-cn/ 302! Language=zh-cn +/ /zh-tw/ 302! Language=zh-tw +/ /en-us/ 302!