Created
January 16, 2024 04:30
-
-
Save apainintheneck/f7c27636c16e029d2d548a1fc371566f to your computer and use it in GitHub Desktop.
Generate a documentation website on Github Pages for a Crystal project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This action does the following on a push to the `main` branch: | |
# 1. It generates the docs website with `crystal docs`. | |
# 2. It bundles that docs folder and pushes it to the `gh-pages` branch. | |
# 3. It deploys that branch to Github pages. | |
# | |
# First time setup: | |
# - Go into the Github settings and specify that the `gh-pages` branch | |
# should be deployed on Github pages. | |
name: Github Pages for Crystal Project | |
on: | |
push: | |
branches: main | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Install Crystal | |
uses: oprypin/install-crystal@v1 | |
with: | |
crystal: latest | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: shards install | |
- name: Generate docs | |
run: crystal docs | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment