Hey Dev.to ๐
Just wanted to share a quick setup Iโm using to publish posts directly to Dev.to using GitHub Actions.
Basically, I write my blog in Markdown, commit it to GitHub, and the post goes live automatically. No manual copy-paste, no forgetting to publish. Super simple, but saves time and keeps everything version-controlled.
This post itself was published that way.
Why bother?
I got tired of switching between editors, formatting things twice, or forgetting what I published where. So I wrote a small Python script that pushes the post to Dev.to, and wrapped it in a GitHub Action. Now itโs just:
git push
โฆand boom ๐ฅ โ post is live.
How it works
You just need:
A publish_to_devto.py script (uses the Dev.to API)
Your blog posts in a /posts folder
A GitHub Action that runs the script on push
Your Dev.to API key stored as a GitHub secret
Thatโs it.
Folder layout
Hereโs what the repo looks like:
.
โโโ posts/
โ โโโ hello-devto.md
โโโ publish_to_devto.py
โโโ .github/workflows/publish.yml
โโโ requirements.txt
One-time setup
Add your Dev.to API key as a GitHub secret (e.g., DEVTO_API_KEY)
Write your blog in Markdown
Push to GitHub
Thatโs it โ your post will show up on your Dev.to profile.
This is the first one Iโve published using the flow โ just testing it out, and so far it works.
Will share the code and full setup in the next post if anyoneโs interested.
Cheers ๐
Top comments (0)