markdeck icon indicating copy to clipboard operation
markdeck copied to clipboard

This is a Guide on how to deploy to Github Pages using Github Actions

Open dmastag opened this issue 5 years ago • 2 comments

Though as per @arnehilmann from #21 :

One of the ideas behind markdeck is the possibility to preview your slides before you have to check in your changes.

But I still think that after you are done previewing your slides you might want to automate the build.

Below is what is working for me

name: publish-slides
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  built-slides:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - name: build
          run: |
            cd slides/src #Folder where your main slides are
            curl -LO https://raw.githubusercontent.com/arnehilmann/markdeck/master/markdeck
            chmod a+x markdeck
            ./markdeck once
        
        - name: Deploy 🚀
          uses: JamesIves/[email protected]
          with:
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
            BRANCH: gh-pages # The branch the action should deploy to.
            FOLDER: slides/src/deck # The folder the action should deploy.
            CLEAN: true # Automatically remove deleted files from the deploy branch

Of course you could also have markdeck already in your repository.

dmastag avatar Sep 29 '20 09:09 dmastag

That looks quite cool! That leads to a couple of questions:

  • Could you give a little bit more context (or even a PR)?
  • Where to put that yaml snippet?
  • How are secrets handled (where comes the secrets.GITHUB_TOKEN from)?
  • Does that work with gh-pages in a docs subfolder (instead of the gh-pages branch)?
  • How long does that take to run? (markdeck is a rather heavy weight to run just once)

arnehilmann avatar Sep 29 '20 10:09 arnehilmann

Sure, I am currently trying to make a github page which is a set of tutorials about Ionic. But I wanted to automate the process. Previously I was using vagrant (in windows) to create a virtual box to build with markdeck. And then copy the deck into a docs folder so github pages can publish it.

The github repo (its in Indonesian language) https://github.com/julianalimin/tuntas-belajar-ionic

And the result is https://julianalimin.github.io/tuntas-belajar-ionic

yaml snippet is in .github/workflows folder and I call it publish-slides.yml

Regarding the github token, its a Predefined environment variables from the Repo

I assume it can work in a docs subfolder but you would need to change the logic or Github Action

The total time its taking is below 2 minutes which is really impressive for me You can see it in my Repo https://github.com/julianalimin/tuntas-belajar-ionic/actions

Honestly this is the first time I tried Github Actions and i just copy pasted the Deploy part from the Documentation. I am an avid gitlab-ci user, but I must say the time it took to get this working and the amount of time for each action to finish is very impressive that I might just switch

dmastag avatar Sep 29 '20 15:09 dmastag