Publish Markdown to the Web With GitHub Actions

Updated

If your content already lives in a Git repository, the simplest publishing button is the merge button. This guide sets up GitHub Actions to publish a folder of Markdown with the Sentilis CLI every time main changes.

What you need

  • A repository with your content folder — for example content/, containing press/, bio/ or any other Sentilis folder.
  • Your Sentilis profile token.

1. Store the token as a secret

In the repository settings, add a secret named SENTILIS_TOKEN with your profile token. Never commit the token to the repository.

2. Add the workflow

Create .github/workflows/publish.yml:

name: Publish content to Sentilis

on:
  push:
    branches: [main]
    paths:
      - "content/**"
  workflow_dispatch:

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Install the Sentilis CLI
        run: npm i -g @sentilis/cli

      - name: Authenticate
        run: sentilis auth login ${{ secrets.SENTILIS_TOKEN }}

      - name: Publish
        run: sentilis sync ./content --strict

What each part does:

  • paths runs the workflow only when content changes.
  • workflow_dispatch adds a button to run it by hand.
  • --strict aborts the run if any entry has a validation problem, so nothing is half-published and the job fails visibly.

3. Validate pull requests

Add a second job, or a second workflow on pull_request, that runs the same steps with --dry-run instead of --strict. It validates every entry without uploading anything, so problems show up in review:

      - name: Validate
        run: sentilis sync ./content --dry-run

Several profiles

The CLI can hold several profiles. If one repository publishes to more than one profile — one per language, for example — run one job per folder, each with its own token secret.

Troubleshooting

  • The job fails on a validation error: that is --strict doing its job. Fix the file named in the log and push again.
  • Nothing changes on the site: check that the pushed files are inside the folder you sync, and that their status is published.

Write in VS Code, publish from CI →

Keep reading

Guides →

Your Markdown is already your content. Now give it a home on the web.

Publish your Markdown →