Add exercise 7 #31
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: Build and deploy static html pages for the SP exercises | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: [ "master" ] | |
# 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 | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
# changes: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# dockerfile: ${{ steps.changes.outputs.dockerfile }} | |
# steps: | |
# - name: Checkout Repository | |
# uses: actions/checkout@v2 | |
# - uses: dorny/paths-filter@v2 | |
# id: changes | |
# with: | |
# filters: | | |
# dockerfile: | |
# - 'Dockerfile' | |
# | |
# create-docker-image: | |
# runs-on: ubuntu-latest | |
# environment: | |
# name: github-pages | |
# needs: changes | |
# if: ${{ needs.changes.outputs.dockerfile == 'true' }} | |
# steps: | |
# - name: Checkout Repository | |
# uses: actions/checkout@v2 | |
# | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v1 | |
# | |
# - name: Login to GitHub Container Registry | |
# uses: docker/login-action@v2 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Build and Push Docker Image | |
# env: | |
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
# run: | | |
# echo "Building and pushing Docker image..." | |
# docker buildx build -t $DOCKER_USERNAME/pandoc-fcse:latest --push . | |
build-htmls: | |
runs-on: ubuntu-latest | |
# needs: create-docker-image | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Install pandoc | |
run: sudo apt-get install -y pandoc | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 # Adjust the Python version as needed | |
- name: Install pypandoc | |
run: | | |
python -m pip install --upgrade pip | |
pip install pypandoc | |
- name: Install xelatex | |
run: sudo apt-get update&&sudo apt-get install -y texlive-xetex # Install xelatex | |
- name: Run create_files.py | |
run: python create_files.py # Convert MD to HTML and PDFs using pypandoc | |
- name: Create index files | |
run: python create_index_pages.py # Create a content HTML named index.html in mk and en subfolders | |
- name: Archive Output Directory | |
uses: actions/upload-artifact@v2 | |
with: | |
name: output-html | |
path: output/output_html # Adjust the path to your output directory | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build-htmls | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: output-html | |
path: created_htmls | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Make sure the files from the artifact are present | |
run: ls -l created_htmls | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: 'created_htmls' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |