consolidate build process #17
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 Docker image and deploy Jekyll site to Pages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
packages: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
imgbuild: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
uses: docker/build-push-action@v3 | |
with: | |
file: Dockerfile.devel | |
push: true | |
tags: ghcr.io/cs357/textbook-devel:latest | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- imgbuild | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v4 | |
- name: Build site in Docker image | |
shell: docker run --rm --mount type=bind,source="$PWD"/,target=/opt/app ghcr.io/cs357/textbook-devel:latest make build | |
- name: Upload artifact | |
# Automatically uploads an artifact from the './_site' directory by default | |
uses: actions/upload-pages-artifact@v3 | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: | |
- imgbuild | |
- build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |