Skip to content

Commit

Permalink
Update markdown-to-html.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlee-06 authored Dec 16, 2024
1 parent 18f0cbe commit 36a137a
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions .github/workflows/markdown-to-html.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,43 @@
# This is a basic workflow to help you get started with Actions

name: Convert Markdown to HTML

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches:
- main # Change this to your default branch if it's not 'main'
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Pandoc
run: |
sudo apt-get update
sudo apt-get install -y pandoc
uses: actions/checkout@v4

- name: Convert README.md to HTML
run: |
pandoc README.md -o index.html
# Converts Markdown to HTML
- name: Convert Markdown to HTML
uses: jaywcjlove/markdown-to-html-cli@main
with:
source: README.md
output: index.html
github-corners: https://github.com/jaywcjlove/markdown-to-html-cli
favicon: data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🌐</text></svg>

- name: Commit and push changes
run: |
git config --local user.name "github-actions"
git config --local user.email "[email protected]"
git add index.html
git commit -m "Update index.html from README.md" || echo "No changes to commit"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Optionally, you can add a step to upload the generated HTML file as an artifact
- name: Upload HTML artifact
uses: actions/upload-artifact@v3
with:
name: index.html
path: index.html

0 comments on commit 36a137a

Please sign in to comment.