| icon | git-compare | |
|---|---|---|
| tags |
|
Add a simple GitHub Action to your project to automate the building and deployment of your Retype powered website.
Currently, there are two Retype related GitHub Actions:
- Retype Build Action
- Retype GitHub Pages Action
The first, Build Action will automatically build your Retype powered website with each new change that is committed.
The second, GitHub Pages Action will automatically publish your newly built website to a branch in Github so it is available to host from GitHub Pages. By default, the retype branch is used, but of course that is also configurable.
You can also deploy to many other hosting services, such as [[Cloudflare]], [[Docker]], [[GitLab Pages]], [[Netlify]], or your own web hosting or VPS provider.
Automatically deploying to GitHub Pages requires a basic retype-action.yml configuration file to be added to your GitHub repo and some simple project configuration.
!!!
Content write permission are required so that Retype and can automatically create the retype branch and write the generated files into that branch.
!!!
- Add a retype-action.yml file, see step 1
- Configure GitHub Pages, see step 2
- Set the branch to
retype, see branch config - Set the
url - More details on the Retype Build Action.
- More details on the Retype GitHub Pages Action.
All of these options are configurable and your specific requirements may vary. There is a lot of flexibility. Please check out the Project Configuration options for full details.
Add the following retype-action.yml file to your GitHub project within the .github/workflows/ folder.
If the .github/workflows/ folders do not exist within the root of your project, you can manually create the folders and they will be committed along with the 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: trueThe above retype-action.yml workflow configuration instructs GitHub Actions to automatically build your website upon each commit to the main branch, and then deploy your new Retype powered website to a retype branch.
!!!tip
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.
!!!
If the retype branch is not available, the GitHub Action will automatically create the branch.
If the default branch in your repo is master, change - main to - master. If the docs project was within a docs branch, change - main to - docs. The following snippet demonstrates setting the branch to master.
push:
branches:
- masterCommit your .github/workflows/retype-action.yml file and push to your repo.
If your project requires a Retype key, that key can be configured by adding a RETYPE_KEY secret to your repository settings and the corresponding env configuration to your project .github/workflows/retype-action.yml file.
{%{
- uses: retypeapp/action-build@latest
env:
RETYPE_KEY: ${{ secrets.RETYPE_KEY }}}%}
!!!tip New Free GitHub Community Key Did you know there is a free Retype Pro Community Key for GitHub Pages hosting? Check it out on the [[Community]] page. !!!
The following sample demonstrates a basic template to use for a workflow configuration file, if including the RETYPE_KEY:
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: trueIf your project uses either protected or private pages, adding a password for your visitors to use is required.
{{ include "snippets/password-notice.md" }}
A password can be configured by adding a RETYPE_PASSWORD secret to your repository settings and the following env configuration to your project .github/workflows/retype-action.yml file.
{%{
- uses: retypeapp/action-build@latest
env:
RETYPE_PASSWORD: ${{ secrets.RETYPE_PASSWORD }}}%}
If both the RETYPE_KEY and RETYPE_PASSWORD are needed, the configuration should be the following:
{%{
- uses: retypeapp/action-build@latest
env:
RETYPE_KEY: ${{ secrets.RETYPE_KEY }}
RETYPE_PASSWORD: ${{ secrets.RETYPE_PASSWORD }}}%}
Once Step 1 is complete, now configure your GitHub Pages web site hosting.