CI/CD examples
Automate HTMLDrop publishes from GitHub Actions, curl, and Node.js.
Last updated June 2, 2026
GitHub Actions
Publish on push to main:
name: Deploy preview to HTMLDrop
on:
push:
branches: [main]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Publish to HTMLDrop
env:
HTMLDROP_API_KEY: ${{ secrets.HTMLDROP_API_KEY }}
run: |
curl -sf -X POST https://htmldrop.in/api/v1/pages \
-H "Authorization: Bearer $HTMLDROP_API_KEY" \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"format": "html",
"html": $(jq -Rs . dist/index.html),
"title": "Production preview",
"customSlug": "my-app-preview"
}
EOF
Store HTMLDROP_API_KEY in repository secrets.
Node.js snippet
const response = await fetch("https://htmldrop.in/api/v1/pages", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.HTMLDROP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
format: "md",
content: "# Changelog\n\nAutomated publish.",
title: "Changelog",
}),
});
if (!response.ok) {
throw new Error(await response.text());
}
const page = await response.json();
console.log(page.url);