Skip to content

Commit

Permalink
added github action for remote building
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetoCodes committed Oct 30, 2024
1 parent 4d15467 commit 6109456
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Generate PDF from Markdown

on:
push:
paths:
- '**/*.md' # Trigger this workflow on Markdown file changes
workflow_dispatch: # Allows manual trigger of the action

jobs:
generate-pdf:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install mdpdf
run: npm install -g mdpdf

- name: Generate PDF
run: mdpdf cv.md --style=styles.css --border-top=12mm --border-bottom=0mm --border-left=4mm --border-right=4mm

- name: Commit and push PDF
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add cv.pdf
git commit -m 'Generate PDF from Markdown'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Ignore node_modules directory
node_modules/

# Ignore log files
*.log

# Ignore build directories
dist/
build/

# Ignore OS-specific files
.DS_Store

# Ignore environment variable files
.env

# Ignore IDE-specific files
.vscode/
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
## Installation
By default, changes to the markdown file in this repository trigger a github action that builds a pdf from the markdown source and commits the file.

To enable the comitting of this file back to this repository click on Settings > Actions > General and (under workflow permissions) select "Read and write permissions" & "Allow GitHub Actions to create and approve pull requests".

```bash
# Run Locally
# Install mdpdf glboally
# or run locally:

# Install mdpdf globally
npm install -g [email protected]

# Build pdf from markdown locally
mdpdf cv.md --style=styles.css --border-top=12mm --border-bottom=1mm --border-left=4mm --border-right=4mm
mdpdf cv.md --style=styles.css --border-top=12mm --border-bottom=0mm --border-left=4mm --border-right=4mm
```

### About
Expand Down

0 comments on commit 6109456

Please sign in to comment.