If you have a blogging site using Jekyll and you want to publish your blogs to your Dev.To account? Then read this article.
Jekyll Project
I have my Jekyll project and I do have 1 post and I want this post to be automatically published to my Dev.To account when I push this post to GitHub. Really excited about that so lets begin.
Publish to dev.to Action
I will use pre-built action by sinedied/publish-devto to publish my post to dev.to.
Market Place Publish to dev.to Action
dev.to Front Matter Guidelines
Make sure you have below attributes in your blog post Front Matter.
Custom variables set for each post, located between the triple-dashed lines in your editor. Here is a list of possibilities:
title: the title of your article
published: boolean that determines whether or not your article is published
description: description area in Twitter cards and open graph cards
tags: max of four tags, needs to be comma-separated
canonical_url: link for the canonical version of the content
cover_image: cover image for post, accepts a URL.
The best size is 1000 x 420.
series: post series name.
β Markdown Basics
Below are some examples of commonly used markdown syntax. If you want to dive deeper, check out this cheat sheet.
Creating API Keys in Dev.To
Login to dev.to and then go to accounts and create new api key.
Creating Github Workflow
Lets create ".github/workflows/publish.yml" file.
It will publish post to dev.to/roopkt whenever merge or push happens to master branch.
name: publish
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Publish articles on dev.to
uses: "sinedied/publish-devto@30728bf"
with:
files: '_posts/**/*.md'
devto_key: ${{ secrets.DEVTO_TOKEN }}
github_token: ${{ secrets.GH_TOKEN }}
conventional_commits: true
Run GitHub CI/CD
Lets update post and push the code to master branch.
Confirm published article on dev.to account
Notice my post published in https://dev.to/roopkt
Here is my article published : "Enforcing Dependency Constraints in Nx Monorepo Projects"
Skipping GitHub CI
Sometime you are not updating your blog rather fixing your site or updating about me or something else. And you don't want to trigger your CI so make sure you add [skip ci]
in your commit comments. So that your blogs will be not published because CI will not trigger.
Notice we have check in our Job to not run if message has '[skip ci]'
Become full stack developer π»
If you want to become full stack developer and grow your carrier as new software developer or Lead Developer/Architect. Consider subscribing to our full stack development training programs. We have All-Access Monthly membership plans and you will get unlimited access to all of our video courses, slides, source code & Monthly video calls.
- Please subscribe to All-Access Membership PRO plan to access current and future angular, node.js and related courses.
- Please subscribe to All-Access Membership ELITE plan to get everything from PRO plan. Additionally, you will get access to monthly live Q&A video call with Rupesh and you can ask doubts/questions and get more help, tips and tricks.
You bright future is waiting for you so visit today FullstackMaster and allow me to help you to board on your dream software company as a Developer,Architect or Lead Engineer role.
π Say π to me!
Rupesh Tiwari
www.rupeshtiwari.com
βοΈ Email Rupesh
Founder of Fullstack Master
Top comments (2)
Thank you, Rupesh! Your article is the best on this subject!
Great idea, but what about the comments and discussions? π€