diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..6d0c424 --- /dev/null +++ b/.github/workflows/pages.yml @@ -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 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..348b8d4 --- /dev/null +++ b/README.md @@ -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]. \ No newline at end of file diff --git a/build.nu b/build.nu index f046120..3febb1d 100644 --- a/build.nu +++ b/build.nu @@ -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 \ No newline at end of file +typst compile main.typ -o pages main.pdf \ No newline at end of file diff --git a/pages/index.html b/pages/index.html new file mode 100644 index 0000000..48897eb --- /dev/null +++ b/pages/index.html @@ -0,0 +1,12 @@ + +
+ + +If you are not redirected automatically, follow this link to the PDF.
+ + \ No newline at end of file