Build and push docs #12
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
name: Build and push docs | |
on: | |
push: | |
branches: [$default-branch] | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
concurrency: ci-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: crystal-lang/install-crystal@v1 | |
- name: Install dependencies | |
run: shards install | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v2 | |
- name: Build docs | |
run: crystal docs --project-version="$(shards version)" | |
- name: Upload artifact | |
# Automatically uploads an artifact from the './_site' directory by default | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: 'docs' | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |