sinedied / publish-devto

:postbox: GitHub Action to publish markdown files on dev.to platform, with assets hosted on GitHub.
MIT License
38 stars 8 forks source link

How to configure publish.yml for images? #17

Closed 0xrushi closed 2 years ago

0xrushi commented 2 years ago
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@v2"
      with:
        files: 'content/posts/**/*.md'
        devto_key: ${{ secrets.DEVTO_TOKEN }}
        github_token: ${{ secrets.GH_TOKEN }}
        branch: master
        conventional_commits: true

and my markdown post is like content/posts/post1.md

---
layout: post
title: 'Running GUI apps from docker inside WSL2.0 as standalone application'
author: rushi
categories: [vpn, digitalocean]
image: '/img/cover.jpg'
featured: true
hidden: false
---

## Hello world

![](/img/test.jpg)

and the error I'm getting is like

content/posts/2020-08-19-DockerGUIwsl.md has error(s):
- Image https://raw.githubusercontent.com/rushichaudhari/rushichaudhari.github.io/main/img/2020-08-19-DockerGUIwsl/image-20200819110253538.png is offline
content/posts/2020-10-29-Setting-up-tigervncserver-on-arch-linux-(raspberry-pi).md has error(s):
- Image https://raw.githubusercontent.com/rushichaudhari/rushichaudhari.github.io/main/content/img/2020-10-29-Setting-up-tigervncserver-on-arch-linux-(raspberry-pi is offline
content/posts/2020-11-28-adding-netlify-cms-to-existing-github-pages-site-within-10-minutes.md has error(s):
- Update failed: HTTPError: Response code 429 (Too Many Requests)
0xrushi commented 2 years ago

I found it It should be https://raw.githubusercontent.com/rushichaudhari/rushichaudhari.github.io/main/static/img/2020-08-19-DockerGUIwsl/image-20200819110253538.png instead of https://raw.githubusercontent.com/rushichaudhari/rushichaudhari.github.io/main/img/2020-08-19-DockerGUIwsl/image-20200819110253538.png

Do we have anything to add that static?

sinedied commented 2 years ago

I think it's because the path in your frontmatter is wrong:

image: '/img/cover.jpg'

should be

image: '/static/img/cover.jpg'
0xrushi commented 2 years ago

Thanks @sinedied , Yes I found that. Just needed some --path argument here for some custom path. because It was based on HUGO and the actual path is /static/img but inside hugo it takes /static as root. Anyways I wrote a custom solution for it. Feel free to close this issue/ add support for HUGO