Deploy to Github pages #298
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
# Simple workflow for deploying static content to GitHub Pages | |
name: Deploy to Github pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group | |
# in the repository is in progress, the queued job or workflow will be pending. Any previously pending job | |
# or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow | |
# in the same concurrency group, specify cancel-in-progress: true. | |
# See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Docker build | |
run: docker build . -t documentation | |
- name: Extract static content | |
uses: shrink/actions-docker-extract@v1 | |
id: extract | |
with: | |
image: documentation # from previous step | |
path: /usr/share/nginx/html/. | |
# Special upload-pages-artifact action that takes care of creating valid artifact for Github Pages | |
# Artifact is called 'github-pages' | |
# See: https://github.com/actions/upload-pages-artifact | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ${{ steps.extract.outputs.destination }} | |
# Single deploy job since we're just deploying | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v1 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
with: | |
artifact_name: github-pages |