diff --git a/.drone.yml b/.drone.yml index 82c0d8f..238a72c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2,6 +2,9 @@ workspace: base: /srv/app path: src +branches: + - master + clone: git: image: plugins/git:1 @@ -17,30 +20,19 @@ pipeline: - make clean - make build - docker: - image: plugins/docker:17.05 + publish: + image: lucap/drone-netlify:latest pull: true - secrets: [ docker_username, docker_password ] - repo: gitea/website - tags: [ '${DRONE_BRANCH##release/v}' ] + secrets: [ netlify_token ] + site_id: 05515f14-3702-4a84-9ff3-88ba90fe08dd + path: public/ when: event: [ push ] - branch: [ release/* ] - - docker: - image: plugins/docker:17.05 - pull: true - secrets: [ docker_username, docker_password ] - repo: gitea/website - tags: [ 'latest' ] - when: - event: [ push ] - branch: [ master ] discord: - image: appleboy/drone-discord:1.0.0 + image: appleboy/drone-discord:1 pull: true secrets: [ discord_webhook_id, discord_webhook_token ] when: - event: [ push, tag, pull_request ] + event: [ push, tag ] status: [ changed, failure ] diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index c69a921..0000000 --- a/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/config.yaml b/config.yaml index 05f5c55..3b46134 100644 --- a/config.yaml +++ b/config.yaml @@ -32,7 +32,7 @@ menu: pre: question - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: Blog url: https://blog.gitea.io/ @@ -80,7 +80,7 @@ languages: pre: question - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: 博客 url: https://blog.gitea.io/ @@ -123,7 +123,7 @@ languages: pre: question - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: 部落格 url: https://blog.gitea.io/ @@ -166,7 +166,7 @@ languages: pre: question - name: API url: https://try.gitea.io/api/swagger - weight: 25 + weight: 45 pre: plug - name: Blog url: https://blog.gitea.io/ @@ -209,7 +209,7 @@ languages: 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/docker/caddy.conf b/docker/caddy.conf deleted file mode 100644 index d1b66ce..0000000 --- a/docker/caddy.conf +++ /dev/null @@ -1,39 +0,0 @@ -:80 { - root /srv/www - - locale en-US zh-CN zh-TW pt-BR nl-NL { - 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} - } - - header / Vary "Accept-Language" -} diff --git a/static/.gitkeep b/static/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/static/_headers b/static/_headers new file mode 100644 index 0000000..b3c268e --- /dev/null +++ b/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/static/_redirects b/static/_redirects new file mode 100644 index 0000000..26c86cf --- /dev/null +++ b/static/_redirects @@ -0,0 +1,8 @@ +https://gitea-website.netlify.com/* https://gitea.io/:splat 302! +https://www.gitea.io/* https://gitea.io/:splat 302! + +/ /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!