DEV Community

Prakhar Kaushik
Prakhar Kaushik

Posted on

Github Action for Auto Publishing My Articles from Hugo blog to Medium

My Workflow

Name: hugo-to-medium

Submission Category:

DIY Deployments

Yaml File or Link to Code

GitHub logo pr4k / hugo-to-medium

Github action to directly post from hugo to medium

hugo-to-medium

GitHub issues GitHub forks GitHub stars GitHub license

Github action to directly post from hugo to medium This is created for those who are always importing their own hugo blog to medium.It uses Medium's API to directly upload the post from hugo to medium

Usage

It uses commit message to identify which post to publish on medium Simply while making a commit include at last PUBLISH <Your-post-name>.md

Example:

git commit -m "Added: post PUBLISH: my-arch-setup.md

Creating main.yml

A sample main.yml can be

on: [push]

jobs:
  hugo_to_medium_job:
    runs-on: ubuntu-latest
    name: hugo-to-medium
    steps:
      # To use this repository's private action, you must check out the repository
      - uses: actions/checkout@v2
        with:
          ref: master
      - name: Hugo To medium Action step 
        uses: pr4k/Hugo-to-Medium@master # Uses an action in the root directory
        id: hello
        env:
          APP_ID: ${{secrets.APP_ID}}
          ACCESS_TOKEN: ${{secrets.ACCESS_TOKEN}}
          APP_SECRET: ${{secrets.APP_SECRET}}
          BLOG_DIR: ${{secrets.BLOG_DIR}}
      #
Enter fullscreen mode Exit fullscreen mode

paste this to .github/workflow/main.yml

APP_ID: This is your medium Developer APP id…

Market Place

Additional Resources / Info

[Note:] # (Be sure to link to any open source projects that are using your workflow!)

Top comments (0)