Merge pull request #10 from csc-training/KP-7438 #5
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: Deploy GitHub Pages, compiling slides and tutorials/handouts to HTML | |
on: | |
push: | |
branches: | |
- main | |
# If you want to test these (*in a forked repository* to avoid overwriting the | |
# real production website), you can enable these rows. In that case you also | |
# need to run a Runner yourself, see instructions in | |
# https://github.com/CSCfi/kielipankki-actions-pipeline/blob/main/runners/README.md | |
# pull_request: | |
# types: | |
# - opened | |
# - reopened | |
# - synchronize | |
# 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: | |
# Build job | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Create html pages from the markdown | |
run: | | |
HOME_PAGE_URL=$(curl -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/${{ github.repository }}/pages \ | |
| jq -r ".html_url") | |
mkdir -p _site/slides | |
mkdir -p _site/tutorials | |
~/convert-single-page.sh index.md _site/index.html | |
~/convert-slides.sh slides/ _site/slides | |
~/convert-tutorials.sh tutorials _site/tutorials $HOME_PAGE_URL | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
# Deployment job | |
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 |