Merge pull request #2 from utsav-bhandari/patch-1 #18
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: Publish to pages | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Marp | |
- name: Use node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Install marp-cli | |
run: npm install -g @marp-team/marp-cli | |
- name: Export slides | |
run: |- | |
# find all index.md files recursively in the current directory | |
readarray -d '' files < <(find . -name "index.md" -type f -print0) | |
# loop over the files array | |
for file in "${files[@]}"; do | |
# check if "marp: true" exists in the file | |
if grep -q "marp: true" "$file"; then | |
# extract the directory path from the file path | |
dir=$(dirname "$file") | |
# generate the output filename | |
output="${dir}/index.html" | |
# convert the file to HTML using marp-cli | |
npx @marp-team/marp-cli "$file" --html -o "$output" | |
else | |
echo "Skipping $file - marp: true not found" | |
fi | |
done | |
# Pages deploy | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: docs/ | |
destination: ./_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
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@v1 |