Merge pull request #14 from brown9804/feature/format #16
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: Convert Markdown to HTML and Deploy | |
on: | |
push: | |
branches: | |
- main # Trigger the workflow on push to the main branch | |
- dev | |
- feature/* | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: npm install | |
- name: Install pandoc | |
run: sudo apt-get install -y pandoc | |
- name: Convert Markdown to HTML | |
run: | | |
mkdir -p _site | |
for file in *.md; do | |
pandoc "$file" --standalone --toc -o "_site/${file%.md}.html" | |
done | |
- name: Deploy to GitHub Pages | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git pull origin ${{ github.ref }} --rebase | |
git add -A # Add all changes, including untracked files | |
git commit -m 'Deploy static HTML files' | |
git push origin HEAD:${{ github.ref }} |