Skip to content

Self publishing

Ruben Taelman edited this page Jun 21, 2022 · 11 revisions

In order to share your article's message with the world, a good practise is to self-publish your article somewhere to avoid that people have to go through a paywall to read it. And since ScholarMarkdown includes machine-readable metadata on your article, it will get indexed by services like Google Scholar;

The output of ScholarMarkdown is a static webpage, which can easily be published on any Web server.

If you don't have a Web server at your disposal, you could use GitHub pages to publish it on a GitHub domain. When combined with GitHub Actions (easiest option) or the Travis continuous integration tool, you could set up a system that will automatically re-publish your article every time you commit a change to GitHub.

GitHub Actions

Example of an article that is automatically published using GitHub Actions and GitHub Pages: https://linkedsoftwaredependencies.github.io/Article-System-Components/ (source)

Reference contents of .github/workflows/deploy-gh-pages.yml (when using GitHub Actions):

name: Build and Deploy
on: [push]
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2.3.1
        with:
          persist-credentials: false

      - name: Setup Ruby ✨
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3.0'
          bundler-cache: true

      - name: Install and Build 🔧
        run: |
          bundle exec nanoc compile
          bundle exec nanoc check internal_links mixed_content stale
      - name: Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@3.6.2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH: gh-pages
          FOLDER: output
          CLEAN: true

Make sure to run bundle lock --add-platform x86_64-linux once in your project (and push the changes to Gemfile.lock) before deploying via GitHub Actions.

Travis

Example of an articles that is automatically published using Travis and GitHub Pages: https://rdfostrich.github.io/article-mocha-2018/ (source)

A detailed guide on how to do this can be found here: https://docs.travis-ci.com/user/deployment/pages/ Create your GITHUB_TOKEN here: https://github.com/settings/tokens (requires at least repo access)

note: Make sure that you deploy the output folder to GitHub pages by adding the following line to your deploy block: local-dir: output.

Reference contents of .travis.yml (when using Travis):

language: ruby
rvm:
  - 2.4.4
bundler_args: --without development
script:
  - bundle exec nanoc compile
  - bundle exec nanoc check internal_links mixed_content stale
cache:
  - bundler
deploy:
  provider: pages
  local-dir: output
  skip-cleanup: true
  github-token: $GITHUB_TOKEN  # Set in the settings page of your repository, as a secure variable
  keep-history: true
  on:
    branch: master
Clone this wiki locally