DEV Community

Denz Mek
Denz Mek

Posted on

Automating Blog Posts to Dev.to with GitHub Actions

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
Enter fullscreen mode Exit fullscreen mode

โ€ฆ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
Enter fullscreen mode Exit fullscreen mode

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)