From 8861933cf845b104e072f35e5f37d7c26097c9dc Mon Sep 17 00:00:00 2001 From: Oleg Lobanov Date: Sat, 28 Jun 2025 22:20:26 +0200 Subject: [PATCH] build: publish docs to cloudflare pages (#5230) --- .dockerignore | 3 +-- .github/workflows/site-publish.yml | 25 +++++++++++++++++++++++++ Dockerfile.site | 2 +- Dockerfile.site.dev | 8 ++------ Makefile | 4 ++-- README.md | 16 +++++----------- {site/docs => docs}/assets/1.jpg | Bin {site/docs => docs}/assets/2.jpg | Bin {site/docs => docs}/assets/3.jpg | Bin {site/docs => docs}/assets/4.jpg | Bin {site/docs => docs}/assets/5.jpg | Bin {site/docs => docs}/assets/6.jpg | Bin {site/docs => docs/assets}/favicon.png | Bin {site/docs => docs/assets}/logo.png | Bin {site/docs => docs}/code-of-conduct.md | 0 {site/docs => docs}/configuration.md | 2 +- {site/docs => docs}/contributing.md | 2 +- {site/docs => docs}/installation.md | 0 {site/docs => docs}/security.md | 0 site/mkdocs.yml | 18 ++++++++---------- 20 files changed, 46 insertions(+), 34 deletions(-) rename {site/docs => docs}/assets/1.jpg (100%) rename {site/docs => docs}/assets/2.jpg (100%) rename {site/docs => docs}/assets/3.jpg (100%) rename {site/docs => docs}/assets/4.jpg (100%) rename {site/docs => docs}/assets/5.jpg (100%) rename {site/docs => docs}/assets/6.jpg (100%) rename {site/docs => docs/assets}/favicon.png (100%) rename {site/docs => docs/assets}/logo.png (100%) rename {site/docs => docs}/code-of-conduct.md (100%) rename {site/docs => docs}/configuration.md (99%) rename {site/docs => docs}/contributing.md (95%) rename {site/docs => docs}/installation.md (100%) rename {site/docs => docs}/security.md (100%) diff --git a/.dockerignore b/.dockerignore index 0b42d767..f7796e79 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,5 +4,4 @@ dist frontend/node_modules frontend/dist filebrowser.db -site/docs/index.md -site/docs/quickstart.md +docs/index.md \ No newline at end of file diff --git a/.github/workflows/site-publish.yml b/.github/workflows/site-publish.yml index 2f512183..66dc5a53 100644 --- a/.github/workflows/site-publish.yml +++ b/.github/workflows/site-publish.yml @@ -38,3 +38,28 @@ jobs: tags: | filebrowser/site:latest ghcr.io/filebrowser/site:latest + + deploy: + permissions: + contents: read + deployments: write + pull-requests: write + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build site + run: make site + + - name: Deploy to Cloudflare Pages + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy site/public/site --project-name=${{ secrets.CLOUDFLARE_PROJECT_NAME }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile.site b/Dockerfile.site index 002cfdc8..a589e2b9 100644 --- a/Dockerfile.site +++ b/Dockerfile.site @@ -7,8 +7,8 @@ COPY LICENSE /build/docs/LICENSE COPY site/ /build/ +COPY docs/ /build/docs/docs COPY README.md /build/docs/index.md -RUN sed -i 's|site/docs/||g' /build/docs/index.md RUN mkdocs build diff --git a/Dockerfile.site.dev b/Dockerfile.site.dev index 24a03f98..b0233752 100644 --- a/Dockerfile.site.dev +++ b/Dockerfile.site.dev @@ -5,15 +5,11 @@ RUN apk add --no-cache inotify-tools WORKDIR /build -COPY site/requirements.txt /build/requirements.txt +COPY site/ /build/ RUN pip install --no-cache-dir -r requirements.txt # Expose the port for mkdocs serve EXPOSE 8000 -# Copy the watch script and make it executable -COPY scripts/watch.sh /usr/local/bin/watch.sh -RUN chmod +x /usr/local/bin/watch.sh - # The entrypoint will run the initial setup and then start the server. -ENTRYPOINT ["/usr/local/bin/watch.sh"] +ENTRYPOINT ["mkdocs", "serve", "-a", "0.0.0.0:8000", "--dirtyreload"] diff --git a/Makefile b/Makefile index 08fc0f97..3120f8b5 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ bump-version: $(standard-version) ## Bump app version .PHONY: site site: ## Build site - @rm -f site/public/* + @rm -rf site/public/site* @docker rm -f spot-site docker build -f Dockerfile.site --progress=plain -t filebrowser.site . docker run -d --name=filebrowser-site filebrowser.site @@ -66,7 +66,7 @@ site: ## Build site .PHONY: site-serve site-serve: ## Serve site for development docker build -f Dockerfile.site.dev -t filebrowser.site.dev . - docker run --rm -it -p 8000:8000 -v $(CURDIR)/site:/build/ -v $(CURDIR)/README.md:/tmp/README.md filebrowser.site.dev + docker run --rm -it -p 8000:8000 -v $(CURDIR)/docs:/build/docs/docs -v $(CURDIR)/README.md:/build/docs/index.md filebrowser.site.dev ## Help: help: ## Show this help diff --git a/README.md b/README.md index 2242e155..47ad6bf4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,4 @@ ---- -hide: - - navigation - - toc ---- # -

@@ -38,21 +32,21 @@ File Browser is a **create-your-own-cloud-kind** of software where you can insta | Easy Login System | Sleek Interface | User Management | | :----------------------: | :----------------------: | :----------------------: | -| ![](./site/docs/assets/1.jpg) | ![](./site/docs/assets/2.jpg) | ![](./site/docs/assets/3.jpg) | +| ![](docs/assets/1.jpg) | ![](docs/assets/2.jpg) | ![](docs/assets/3.jpg) | | File Editing | Custom Commands | Customization | | :----------------------: | :----------------------: | :----------------------: | -| ![](./site/docs/assets/4.jpg) | ![](./site/docs/assets/5.jpg) | ![](./site/docs/assets/6.jpg) | +| ![](docs/assets/4.jpg) | ![](docs/assets/5.jpg) | ![](docs/assets/6.jpg) | ## Install -For information on how to install File Browser, please check [installation](./site/docs/installation.md). +For information on how to install File Browser, please check [installation](docs/installation.md). ## Configuration -For information on how to configure File Browser, please check [configuration](./site/docs/configuration.md). +For information on how to configure File Browser, please check [configuration](docs/configuration.md). ## Contributing -For information on how to contribute to the project, including how translations are managed, please check [contributing](./site/docs/contributing.md). +For information on how to contribute to the project, including how translations are managed, please check [contributing](docs/contributing.md). diff --git a/site/docs/assets/1.jpg b/docs/assets/1.jpg similarity index 100% rename from site/docs/assets/1.jpg rename to docs/assets/1.jpg diff --git a/site/docs/assets/2.jpg b/docs/assets/2.jpg similarity index 100% rename from site/docs/assets/2.jpg rename to docs/assets/2.jpg diff --git a/site/docs/assets/3.jpg b/docs/assets/3.jpg similarity index 100% rename from site/docs/assets/3.jpg rename to docs/assets/3.jpg diff --git a/site/docs/assets/4.jpg b/docs/assets/4.jpg similarity index 100% rename from site/docs/assets/4.jpg rename to docs/assets/4.jpg diff --git a/site/docs/assets/5.jpg b/docs/assets/5.jpg similarity index 100% rename from site/docs/assets/5.jpg rename to docs/assets/5.jpg diff --git a/site/docs/assets/6.jpg b/docs/assets/6.jpg similarity index 100% rename from site/docs/assets/6.jpg rename to docs/assets/6.jpg diff --git a/site/docs/favicon.png b/docs/assets/favicon.png similarity index 100% rename from site/docs/favicon.png rename to docs/assets/favicon.png diff --git a/site/docs/logo.png b/docs/assets/logo.png similarity index 100% rename from site/docs/logo.png rename to docs/assets/logo.png diff --git a/site/docs/code-of-conduct.md b/docs/code-of-conduct.md similarity index 100% rename from site/docs/code-of-conduct.md rename to docs/code-of-conduct.md diff --git a/site/docs/configuration.md b/docs/configuration.md similarity index 99% rename from site/docs/configuration.md rename to docs/configuration.md index 2add31e7..03d677d5 100644 --- a/site/docs/configuration.md +++ b/docs/configuration.md @@ -42,7 +42,7 @@ The icons are cached, to make the new ones appear more quickly open developer to ## Authentication Method -Right now, there are three possible authentication methods. Each one of them has its own capabilities and specification. If you are interested in contributing with one more authentication method, please [check the guidelines](./contributing.md). +Right now, there are three possible authentication methods. Each one of them has its own capabilities and specification. If you are interested in contributing with one more authentication method, please [check the guidelines](contributing.md). ### JSON Auth (default) diff --git a/site/docs/contributing.md b/docs/contributing.md similarity index 95% rename from site/docs/contributing.md rename to docs/contributing.md index 0021c9fb..b72c6b70 100644 --- a/site/docs/contributing.md +++ b/docs/contributing.md @@ -1,6 +1,6 @@ # Contributing -If you're interested in contributing to this project, this is the best place to start. Before contributing to this project, please take a bit of time to read our [Code of Conduct](./code-of-conduct.md). Also, note that this project is open-source and licensed under [Apache License 2.0](../LICENSE). +If you're interested in contributing to this project, this is the best place to start. Before contributing to this project, please take a bit of time to read our [Code of Conduct](code-of-conduct.md). Also, note that this project is open-source and licensed under [Apache License 2.0](../LICENSE). ## Project Structure diff --git a/site/docs/installation.md b/docs/installation.md similarity index 100% rename from site/docs/installation.md rename to docs/installation.md diff --git a/site/docs/security.md b/docs/security.md similarity index 100% rename from site/docs/security.md rename to docs/security.md diff --git a/site/mkdocs.yml b/site/mkdocs.yml index 6fca3f1e..6576a9c6 100644 --- a/site/mkdocs.yml +++ b/site/mkdocs.yml @@ -5,15 +5,15 @@ site_url: 'https://filebrowser.org' repo_name: 'filebrowser/filebrowser' repo_url: 'https://github.com/filebrowser/filebrowser' -edit_uri: 'edit/master/site/docs/' +edit_uri: 'edit/master/docs/' copyright: 'Copyright © 2025 Filebrowser Community' theme: name: material language: en - logo: logo.png - favicon: favicon.png + logo: docs/assets/logo.png + favicon: docs/assets/favicon.png palette: - scheme: default primary: blue @@ -44,8 +44,6 @@ theme: - search.highlight - search.share - content.code.copy - - content.action.edit - - content.action.view - toc.follow - toc.integrate @@ -113,9 +111,9 @@ extra: nav: - Home: index.md - Getting Started: - - Installation: installation.md - - Configuration: configuration.md - - Security: security.md + - Installation: docs/installation.md + - Configuration: docs/configuration.md + - Security: docs/security.md - Contributing: - - Contributing: contributing.md - - Code of Conduct: code-of-conduct.md + - Contributing: docs/contributing.md + - Code of Conduct: docs/code-of-conduct.md