add GH pages

This commit is contained in:
Daniel Bulant 2025-10-07 17:26:09 +02:00
parent 94711b2ec7
commit 0e1255404f
No known key found for this signature in database
4 changed files with 74 additions and 4 deletions

51
.github/workflows/pages.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Build and Deploy GitHub Pages
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: hustcer/setup-nu@v3
with:
version: "0.90"
- uses: typst-community/setup-typst@v4
- name: Build site
run: |
nu build.nu
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './pages'
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@v4

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# Introduction to programming
This repository contains the descriptions and code solutions of selected exercises from the book "Introduction to Programming in Java: An Interdisciplinary Approach" by Robert Sedgewick and Kevin Wayne (2nd edition).
Submitted documents are merged into a single PDF that can be found [here] or [viewed online].

View file

@ -7,9 +7,11 @@ each { |folder|
if ("doc.typ" | path exists) {
typst compile doc.typ
}
let zip = ("../" + $folder + ".zip")
rm -f $zip
7z a $zip *
if ($env.CI? | is-empty) {
let zip = ("../" + $folder + ".zip")
rm -f $zip
7z a $zip *
}
}
typst compile main.typ
typst compile main.typ -o pages main.pdf

12
pages/index.html Normal file
View file

@ -0,0 +1,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Introduction to Programming</title>
<!-- redirect to main.pdf -->
<meta http-equiv="refresh" content="0; url=main.pdf">
</head>
<body>
<p>If you are not redirected automatically, follow this <a href="main.pdf">link to the PDF</a>.</p>
</body>
</html>