Skip to content

Commit

Permalink
upgrade docusaurus and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ApplebaumIan committed Jan 11, 2025
1 parent f63bb87 commit f86a6da
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 11,536 deletions.
37 changes: 7 additions & 30 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

# .github/workflows/deploy-docs.yml
name: Deploy Docs

on:
push:
branches: [ "main" ]

jobs:
deploy:
runs-on: ubuntu-latest
env:
GIT_USER: ${{secrets.USER}}
GIT_PASS: ${{secrets.TOKEN}}
GIT_USER: ${{ secrets.USER }}
GIT_PASS: ${{ secrets.TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install
- name: Install Dependencies
run: cd documentation && yarn install
- name: Determine Semester
id: semester
run: |
CURRENT_MONTH=$(date +%-m)
CURRENT_YEAR=$(date +%Y)
CURRENT_YEAR=$(date +%Y)
if [[ "$CURRENT_MONTH" -ge 1 && "$CURRENT_MONTH" -le 5 ]]; then
SEMESTER="Spring"
elif [[ "$CURRENT_MONTH" -ge 8 && "$CURRENT_MONTH" -le 12 ]]; then
Expand All @@ -30,32 +29,10 @@ jobs:
fi
echo "SEMESTER_YEAR=${SEMESTER} ${CURRENT_YEAR}" >> $GITHUB_ENV
- name: Deploy
- name: Deploy Website
run: |
export ORG_NAME=$(echo ${GITHUB_REPOSITORY%/*})
export PROJECT_NAME=$(echo ${GITHUB_REPOSITORY#*/})
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)"
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
cd documentation && yarn deploy
- name: Make PDF
run: |
export PROJECT_NAME=$(echo ${GITHUB_REPOSITORY#*/})
cd documentation
yarn pdf
- name: Combine PDFs
uses: amoeba/combine-pdf-action@v1
with:
path: resources
- name: Rename PDF
run: |
mv resources/combined.pdf syllabus.pdf
- name: Upload PDF to Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ github.run_number }}"
name: ${{ env.SEMESTER_YEAR }} Course Syllabus
files: syllabus.pdf
draft: false
prerelease: false
54 changes: 54 additions & 0 deletions .github/workflows/generate-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# .github/workflows/generate-pdf.yml
name: Generate PDF

on:
push:
branches:
- main

jobs:
generate-pdf:
runs-on: ubuntu-latest
env:
GIT_USER: ${{ secrets.USER }}
GIT_PASS: ${{ secrets.TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: cd documentation && yarn install
- name: Determine Semester
id: semester
run: |
CURRENT_MONTH=$(date +%-m)
CURRENT_YEAR=$(date +%Y)
if [[ "$CURRENT_MONTH" -ge 1 && "$CURRENT_MONTH" -le 5 ]]; then
SEMESTER="Spring"
elif [[ "$CURRENT_MONTH" -ge 8 && "$CURRENT_MONTH" -le 12 ]]; then
SEMESTER="Fall"
else
SEMESTER="Summer"
fi
echo "SEMESTER_YEAR=${SEMESTER} ${CURRENT_YEAR}" >> $GITHUB_ENV
- name: Generate PDF
run: |
export PROJECT_NAME=$(echo ${GITHUB_REPOSITORY#*/})
cd documentation
yarn pdf
- name: Combine PDFs
uses: amoeba/combine-pdf-action@v1
with:
path: resources
- name: Rename PDF
run: |
mv resources/combined.pdf syllabus.pdf
- name: Upload PDF to Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "${{ github.run_number }}"
name: ${{ env.SEMESTER_YEAR }} Course Syllabus
files: syllabus.pdf
draft: false
prerelease: false
3 changes: 2 additions & 1 deletion documentation/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const main_template_jira_scripts = () => {
return []
}
}
const is_pdf = process.env.PDF; // helper env variable to ignore parts that shouldn't be a part of the PDF. Basically tell docusaurus whether its being rendered as a PDF or not.
const is_pdf = process.env.PDF === undefined ? false : process.env.PDF ; // helper env variable to ignore parts that shouldn't be a part of the PDF. Basically tell docusaurus whether its being rendered as a PDF or not.
const course_number = 'CIS 4398';
const semester = process.env.SEMESTER_YEAR;

// You can change the title here. The default is the name of the repository.
const title = ''+process.env.PROJECT_NAME.replaceAll('-',' ').split(' ').map((word) => {
return word[0].toUpperCase() + word.substring(1);
Expand Down
21 changes: 12 additions & 9 deletions documentation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"pdf": "mkdir ../resources && PDF=true yarn build && PDF=true yarn serve --no-open & sleep 20 && npx docs-to-pdf --outputPDFFilename=\"../resources/1-syllabus.pdf\" --initialDocURLs=\"http://localhost:3000\" --baseUrl=\"https://capstone.ianapplebaum.com\" --contentSelector=\"main\" --paginationSelector=\"a.pagination-nav__link.pagination-nav__link--next\" --excludeSelectors=\".margin-vert--xl a,[class^='tocCollapsible'],.breadcrumbs,.theme-edit-this-page\" --coverImage=\"https://capstone.ianapplebaum.com/img/dont-panic.svg\" --coverTitle=\"4398 Projects in Computer Science $SEMESTER_YEAR Course Syllabus\" && npx docs-to-pdf --outputPDFFilename=\"../resources/2-docs.pdf\" --initialDocURLs=\"http://localhost:3000/docs/proposal\" --baseUrl=\"https://capstone.ianapplebaum.com\" --contentSelector=\"main\" --paginationSelector=\"a.pagination-nav__link.pagination-nav__link--next\" --excludeSelectors=\".margin-vert--xl a,[class^='tocCollapsible'],.breadcrumbs,.theme-edit-this-page\" --coverImage=\"https://capstone.ianapplebaum.com/img/dont-panic.svg\" --coverTitle=\"4398 Projects in Computer Science Documentation Descriptions\""
"pdf": "mkdir -p ../resources && PDF=true yarn build && PDF=true yarn serve --no-open & wait-on http://localhost:3000 && npx docs-to-pdf --outputPDFFilename=\"../resources/1-syllabus.pdf\" --initialDocURLs=\"http://localhost:3000\" --baseUrl=\"https://capstone.ianapplebaum.com\" --contentSelector=\"main\" --paginationSelector=\"a.pagination-nav__link.pagination-nav__link--next\" --excludeSelectors=\".margin-vert--xl a,[class^='tocCollapsible'],.breadcrumbs,.theme-edit-this-page\" --coverImage=\"https://capstone.ianapplebaum.com/img/dont-panic.svg\" --coverTitle=\"4398 Projects in Computer Science $SEMESTER_YEAR Course Syllabus\" && npx docs-to-pdf --outputPDFFilename=\"../resources/2-docs.pdf\" --initialDocURLs=\"http://localhost:3000/docs/proposal\" --baseUrl=\"https://capstone.ianapplebaum.com\" --contentSelector=\"main\" --paginationSelector=\"a.pagination-nav__link.pagination-nav__link--next\" --excludeSelectors=\".margin-vert--xl a,[class^='tocCollapsible'],.breadcrumbs,.theme-edit-this-page\" --coverImage=\"https://capstone.ianapplebaum.com/img/dont-panic.svg\" --coverTitle=\"4398 Projects in Computer Science Documentation Descriptions\""
},
"bin": "./.bin/bin.js",
"dependencies": {
"@docusaurus/core": "^3.1.1",
"@docusaurus/preset-classic": "^3.1.1",
"@docusaurus/theme-live-codeblock": "^3.1.1",
"@docusaurus/theme-mermaid": "^3.1.1",
"@docusaurus/core": "^3.7.0",
"@docusaurus/preset-classic": "^3.7.0",
"@docusaurus/theme-live-codeblock": "^3.7.0",
"@docusaurus/theme-mermaid": "^3.7.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mdx-js/react": "^3.0.0",
"axios": "^1.2.2",
"bufferutil": "^4.0.7",
"canvas": "^2.11.2",
"clsx": "^2.0.0",
"docusaurus2-dotenv-2": "^1.4.1",
"jsdom": "^22.1.0",
Expand All @@ -34,11 +35,13 @@
"react-calendly": "^4.3.0",
"react-dom": "^18.2.0",
"react-medium-image-zoom": "^5.1.8",
"redocusaurus": "^1.3.0",
"redocusaurus": "^2.2.0",
"styled-components": "^6.1.14",
"utf-8-validate": "^6.0.3"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.1.0"
"@docusaurus/module-type-aliases": "^3.7.0",
"wait-on": "^8.0.2"
},
"browserslist": {
"production": [
Expand All @@ -52,4 +55,4 @@
"last 1 safari version"
]
}
}
}
4 changes: 2 additions & 2 deletions documentation/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ export default function Home() {
<main>
<div style={{zIndex:100000}}>
<MDXContent>
<div className={"mobile-live-demo"}>
{!docusaurusConfig.customFields.is_pdf && <div className={"mobile-live-demo"}>
<h2>Watch Live 🔴</h2>
<h3>December 9th 9:30am to 3:20pm EST on YouTube</h3>
<DemoLineUp/>
</div>
</div>}
<SyllabusPage/>
</MDXContent>
</div>
Expand Down
Loading

0 comments on commit f86a6da

Please sign in to comment.