Code Monkey home page Code Monkey logo

Comments (3)

alerque avatar alerque commented on June 19, 2024

To do that via docker-run steps in an actions workflow you would either need to install Python into the Pandoc image or Pandoc into some image of your own. Personally I'd suggest a 3rd route of just making your own image with your own tools and using that as your runner.

For example you could do this with Nix:

shell.nix: (in your project's root)

with import <nixpkgs> {};
mkShell {
  nativeBuildInputs = [ python pandoc ];
}

.github/workflow/build.yml: (step)

- name: Run builder in nix
  uses: docker://nixos/nix
  run: |
    nix-shell --run ./build.py

Similar things could be done with almost any Linux distro base image of your choice (that happens to have Pandoc and Python packages).

from pandoc-action-example.

kwsp avatar kwsp commented on June 19, 2024

I found a better way to do this. Github Action actually lets you run jobs inside docker containers, rather simply using the entrypoint's of a given container (which is currently the only version specified in the README). This is done by specifying the container value of a job. For example,

name: Build
on: push

jobs:
  convert_via_pandoc:
    runs-on: ubuntu-20.04
    container: 
      image: pandoc/core:2.9

    steps:
      - uses: actions/checkout@v2
 
      - run: pandoc README.md -o README.html

This way, it's a lot easier to build custom images with custom dependencies, specifying the container value, then having access to all those executables in your PATH in the rest of the job script. For example, I built a custom image that adds the python3 dependency: tigernie/pandoc-python3,

Should we add this to the README for when people come to this repo from search with this use case in mind?

from pandoc-action-example.

alerque avatar alerque commented on June 19, 2024

We already have a PR mentioning the parent container method, see #11. Note this does have a downside of not being able to run other Action tooling via uses: as easily because many of them depend on the tooling in the Ubuntu base images.

That aside, the container trick in itself doesn't answer your original question because it doesn't have the other tooling you need in the Pandoc image. Making your own image with your own tools is certainly viable (and what I recommended above) but I'm not sure how best to document that as there are so many possible variants of that with different distros, places to keep sources or images, etc. It can be done via external images as you've done or even in the same project (you can use a Dockerfile from the current repo to run containers in CI).

from pandoc-action-example.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.