Skip to main content
Add a GitHub Actions workflow to your repository to automatically build and publish your Retype site whenever you push changes. Retype provides two official GitHub Actions: The workflow runs on every push to your default branch, builds the site, and deploys it to a retype branch that GitHub Pages serves.
The workflow requires contents: write permission so that Retype can create the retype branch and write the generated files into it.

Setup checklist

  • Add a retype-action.yml workflow file (Step 1 below)
  • Configure GitHub Pages to serve from the retype branch (Step 2 below)
  • Set the url in your retype.yml
  • Add a RETYPE_KEY secret if you use Retype Pro features

Step 1: Add the workflow file

1

Create the workflows directory

Create the .github/workflows/ directory in the root of your repository if it does not already exist.
2

Add retype-action.yml

Create the file .github/workflows/retype-action.yml with the following content:
.github/workflows/retype-action.yml
name: Publish Retype powered website to GitHub Pages
on:
  workflow_dispatch:
  push:
    branches:
      - main

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - uses: retypeapp/action-build@latest

      - uses: retypeapp/action-github-pages@latest
        with:
          update-branch: true
The fetch-depth: 0 setting tells GitHub Actions to download the full Git history instead of a shallow clone. This is required if you want Retype to generate automatic lastUpdated footer values from Git commit metadata.
3

Commit and push

Commit the workflow file and push to your repository. The action will run automatically on the next push to main.
If your default branch is named master or docs, update the branch name in the workflow:
push:
  branches:
    - master

Step 2: Configure GitHub Pages

1

Open repository settings

Go to your repository on GitHub and click Settings.
2

Navigate to Pages

In the left sidebar, click Pages.
3

Set the source branch

Under Build and deployment, set the source to Deploy from a branch and select the retype branch. If the retype branch does not exist yet, push the workflow file first to trigger the initial build.
4

Save

Click Save. GitHub Pages will now serve your site from the retype branch.

Environment variables and secrets

RETYPE_KEY

If your project uses Retype Pro features, add your license key as a repository secret and reference it in the workflow.
1

Add the secret

Go to Settings > Secrets and variables > Actions in your repository and create a new secret named RETYPE_KEY with your license key as the value.
2

Update the workflow

Pass the secret to the build action:
.github/workflows/retype-action.yml
name: Publish Retype powered website to GitHub Pages
on:
  workflow_dispatch:
  push:
    branches:
      - main

jobs:
  publish:
    name: Publish to retype branch
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - uses: retypeapp/action-build@latest
        env:
          RETYPE_KEY: ${{ secrets.RETYPE_KEY }}

      - uses: retypeapp/action-github-pages@latest
        with:
          update-branch: true
There is a free Retype Pro Community Key available for projects hosted on GitHub Pages. See the Community page for details.

RETYPE_PASSWORD

If your project uses protected or private pages, add a RETYPE_PASSWORD secret and include it in the workflow:
- uses: retypeapp/action-build@latest
  env:
    RETYPE_PASSWORD: ${{ secrets.RETYPE_PASSWORD }}
If you need both a key and a password:
- uses: retypeapp/action-build@latest
  env:
    RETYPE_KEY: ${{ secrets.RETYPE_KEY }}
    RETYPE_PASSWORD: ${{ secrets.RETYPE_PASSWORD }}

Other hosting providers

The retypeapp/action-build action produces a standard set of static files. You can deploy that output to any static hosting provider — Cloudflare Pages, Netlify, GitLab Pages, or your own server — by replacing the retypeapp/action-github-pages step with a deployment step for your target platform.