This directory contains scripts and configuration for automated deployment of Micro.blog themes via GitHub Actions.
Micro.blog doesn't provide traditional API tokens or CI/CD integration for theme template deployment. This solution works around that limitation by:
- Email-based Authentication: Uses Micro.blog's "Sign in with email" feature to obtain a session cookie
- Session Cookie Caching: Stores the session cookie (7-day expiry) to avoid re-authentication on every deployment
- Theme Reload: POSTs to
/account/themes/reloadto sync theme files from GitHub - Build Automation: Visits
/account/logsto trigger site rebuild - Build Monitoring: Polls
/posts/checkto monitor build completion
# 1. Install dependencies
cd .github/deploy
pip3 install -r requirements.txt
# 2. Set environment variables (create .env file in repo root)
export GMAIL_EMAIL="your@gmail.com"
export GMAIL_APP_PASSWORD="your-app-password"
export MICROBLOG_EMAIL="your@microblog-email.com"
export MICROBLOG_SITE_ID="12345"
export MICROBLOG_THEME_ID="67890"
# 3. Authenticate (saves .session-cookie)
python3 microblog_auth.py
# 4. Deploy
python3 microblog_deploy.py --allThe workflow at .github/workflows/deploy.yml runs automatically on pushes to main that modify:
layouts/**static/**theme.tomlplugin.json
Required GitHub secrets and variables:
- Secret:
GMAIL_APP_PASSWORD - Variables:
GMAIL_EMAIL,MICROBLOG_EMAIL,MICROBLOG_SITE_ID,MICROBLOG_THEME_ID
- Go to https://myaccount.google.com/security
- Enable 2-Step Verification (if not already enabled)
- Go to https://myaccount.google.com/apppasswords
- Select app: "Mail" and device: "Other (Custom name)"
- Enter name like "Micro.blog Deployment" and click Generate
- Copy the 16-character password (without spaces)
Site ID:
- Go to https://micro.blog/account
- Click on your site settings
- The URL will contain your site ID:
/account/sites/{SITE_ID}
Theme ID:
- Go to Design → Edit Custom Themes
- Click on your theme
- The URL will contain your theme ID:
/account/themes/{THEME_ID}/info
In your GitHub repository:
- Go to Settings → Secrets and variables → Actions
- Add secret:
GMAIL_APP_PASSWORD(your Gmail app password) - Add variables:
GMAIL_EMAIL(your Gmail address)MICROBLOG_EMAIL(your Micro.blog email)MICROBLOG_SITE_ID(your site ID)MICROBLOG_THEME_ID(your theme ID)
microblog_auth.py- Email authentication and session cookie capturemicroblog_deploy.py- Template reload, rebuild trigger, and build monitoringrequirements.txt- Python dependenciesREADME.md- This file
Re-authenticate locally:
python3 .github/deploy/microblog_auth.pyMake sure you're using an app password, not your regular Gmail password.
Typical builds complete in 15-50 seconds. If timing out consistently, check build logs at https://micro.blog/account/logs
For issues or questions, see the Micro.blog help forum at https://help.micro.blog