added (but remains still commented) download of laters quarto version… #13
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: Quarto Markdown Render, Convert MD and IPYNB to HTML, Generate Sitemap, and Deploy | |
#navigate to gh-pages branch where all will be populated. Moreover, use the same branch with /root combination for deployment. | |
on: | |
push: | |
paths: | |
- '**/*.qmd' # Trigger the action only when .qmd files are modified or pushed | |
- '**/*.md' | |
- '**/*.ipynb' | |
pull_request: | |
paths: | |
- '**/*.qmd' # Also trigger on pull requests that modify .qmd files | |
- '**/*.md' | |
- '**/*.ipynb' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# 1. Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# 2. Install Quarto | |
- name: Install Quarto | |
run: | | |
wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.340/quarto-1.3.340-linux-amd64.deb | |
sudo dpkg -i quarto-1.3.340-linux-amd64.deb | |
# replace above with the following lines if latest qarto should be used. | |
# sudo apt-get update | |
# sudo apt-get install -y wget gdebi-core | |
# wget https://github.com/quarto-dev/quarto-cli/releases/latest/download/quarto-linux-amd64.deb | |
# sudo gdebi -n quarto-linux-amd64.deb | |
# 3. Render all .qmd, .md, and .ipynb files to HTML | |
- name: Render all Quarto, Markdown, and Jupyter files to HTML | |
run: | | |
# Render .qmd files to HTML | |
quarto render *.qmd --to html || true | |
# Render .md files to HTML | |
quarto render *.md --to html || true | |
# Render .ipynb files to HTML | |
quarto render *.ipynb --to html || true | |
# 4. Move the generated HTML file to the docs folder | |
- name: Move rendered HTML to docs | |
run: | | |
mkdir -p docs | |
#mv *.html docs/ # Move the HTML file(s) into the docs folder | |
find . -name '*.html' -exec mv {} docs/ \; | |
# 5. Generate Sitemap according to Google Sitemap Standards | |
- name: Generate Sitemap | |
run: | | |
# Create the sitemap.xml file | |
echo '<?xml version="1.0" encoding="UTF-8"?>' > docs/sitemap.xml | |
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' >> docs/sitemap.xml | |
# For each .html file in the docs folder, add its URL to the sitemap | |
for f in docs/*.html; do | |
fname=$(basename "$f") | |
echo " <url>" >> docs/sitemap.xml | |
echo " <loc>https://<your-username>.github.io/<your-repo-name>/$fname</loc>" >> docs/sitemap.xml | |
echo " <lastmod>$(date -u +"%Y-%m-%dT%H:%M:%SZ")</lastmod>" >> docs/sitemap.xml # ISO 8601 date format | |
echo " <changefreq>monthly</changefreq>" >> docs/sitemap.xml # You can adjust the change frequency | |
echo " <priority>0.8</priority>" >> docs/sitemap.xml # Default priority | |
echo " </url>" >> docs/sitemap.xml | |
done | |
echo '</urlset>' >> docs/sitemap.xml | |
# 6. Deploy the docs folder to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs |