Update .gitea/workflows/deploy.yaml
Some checks failed
Deploy to Cloudflare Pages via API / deploy (push) Failing after 51s

This commit is contained in:
2025-10-27 12:00:17 +00:00
parent 0dc6452df0
commit b8b031eb2e

View File

@@ -1,15 +1,19 @@
name: Deploy to Cloudflare Pages
name: Deploy to Cloudflare Pages via API
on:
push:
branches:
- master # Adjust branch if needed
- master
jobs:
deploy:
runs-on: ubuntu-latest # Assumes you have a Gitea runner with Ubuntu
runs-on: ubuntu-latest
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: your-account-id # Replace with your Cloudflare Account ID (from Dashboard > Account)
PAGES_PROJECT_NAME: test # Replace with your Pages project name
steps:
- name: Checkout code
uses: actions/checkout@v4 # This action is compatible with Gitea
uses: actions/checkout@v4
- name: Install MkDocs
run: |
@@ -17,21 +21,28 @@ jobs:
sudo apt install python3 python3-pip mkdocs mkdocs-material -y
- name: Build MkDocs
run: mkdocs build
- name: Install curl and zip
run: sudo apt install curl zip -y
- name: Create deployment archive
run: |
mkdocs build
# Optional: If you need to move files like sitemap, uncomment and adjust:
# mv ./docs/sitemap.xml ./site/sitemap.xml
cd site # MkDocs output directory
zip -r ../deployment.zip . # Zip the built files
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Wrangler
run: npm install -g wrangler
- name: Authenticate with Cloudflare
run: wrangler login
- name: Deploy to Pages
run: wrangler pages deploy site --project-name test --branch master
- name: Deploy to Cloudflare Pages
run: |
# Create a new deployment
DEPLOY_RESPONSE=$(curl -X POST "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects/$PAGES_PROJECT_NAME/deployments" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-F "files=@deployment.zip" \
-F "manifest={\"site\": \"site\"}") # Adjust manifest if needed
# Check for success
if echo "$DEPLOY_RESPONSE" | grep -q '"success":true'; then
echo "Deployment successful!"
else
echo "Deployment failed: $DEPLOY_RESPONSE"
exit 1
fi