Closed segg21 closed 10 months ago
Hi @segg21 ,
I am not familiar with cloudflare pages (https://pages.cloudflare.com/)
One thing you could do, is setup cloudflare pages to deploy your gh-pages
branch, instead of the default branch.
Now you can use mkdocs gh-deploy --force
(docs) locally to push the build to that branch automatically.
You could also use github actions to build and push to gh-pages
whenever you push to master
/ main
, see https://squidfunk.github.io/mkdocs-material/publishing-your-site/?h=github+ac#with-github-actions (but make sure to change the git clone depth in that case). Note that mkdocs gh-deploy
has an option to use a different branch name than gh-pages
also.
If you really want to use cloudflare builds, I can't help you with that. I searched for you, I didn't find an option to specify clone depth.
Thanks. I ended up figuring out. I didn't want to use GitHub pages due to limitations, and the extra benefits CF pages provides.
@segg21 What ended up being your solution to this? I also am in the same situation and cannot find any documentation on how to change the fetch-depth for CF Pages.
@segg21 What ended up being your solution to this? I also am in the same situation and cannot find any documentation on how to change the fetch-depth for CF Pages.
Instead of CloudFlare automatically detecting updates, building, and publishing itself, I'm using GitHub actions (that does building w/ fetch-depth) and pushing site contents to CloudFlare using cloudflare/pages-action@v1
Here an example of the action I have setup.
You'll need to disable GitHub automation within CloudFlare's dashboard for your page.
@segg21 What ended up being your solution to this? I also am in the same situation and cannot find any documentation on how to change the fetch-depth for CF Pages.
Instead of CloudFlare automatically detecting updates, building, and publishing itself, I'm using GitHub actions (that does building w/ fetch-depth) and pushing site contents to CloudFlare using cloudflare/pages-action@v1
Here an example of the action I have setup.
You'll need to disable GitHub automation within CloudFlare's dashboard for your page.
That makes perfect sense. Thanks for all the info! I think I'll follow your lead on this and do something similar.
segg21's link to example doesn't work anymore, so I'm pasting here the contents of the .github/workflows/publish.yml
file that works for me.
on: [push]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
name: Publish to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Run a build step here if your project requires
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x' # Set up the Python version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build the MkDocs site
run: mkdocs build # Builds your documentation
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: YOUR_ACCOUNT_ID
projectName: YOUR_PROJECT_NAME
directory: ./site
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# Optional: Switch what branch you are publishing to.
# By default this will be the branch which triggered this workflow
branch: main
I'm currently trying to figure out how with cloudflare pages to fix the
fetch-depth
issue. Cloudflare is automatically doing the deployment/pipeline without any github workflow files.I'm not sure how to fix this issue so that file created timestamps are proper, not from last commit date.
Thanks!