Skip to content

Instantly share code, notes, and snippets.

@AlbertVeli
Last active June 22, 2024 18:46
Show Gist options
  • Save AlbertVeli/321ead4bfc2226afb057a2bd16313e50 to your computer and use it in GitHub Desktop.
Save AlbertVeli/321ead4bfc2226afb057a2bd16313e50 to your computer and use it in GitHub Desktop.
Deploy Makefile 2
# Created by ChatGPT 4.0o, untested
SRC_DIR := .
BUILD_DIR := public_html
DEST_DIR := /path/to/production
SERVER := user@production-server.com
MD_FILES := $(wildcard $(SRC_DIR)/*.md)
HTML_FILES := $(MD_FILES:$(SRC_DIR)/%.md=$(BUILD_DIR)/%.html)
# Rule to convert markdown to HTML
$(BUILD_DIR)/%.html: $(SRC_DIR)/%.md
mkdir -p $(BUILD_DIR)
# You can try some other markdown to html converter
# if pandoc isn't good enough. GitHub uses cmark-gfm.
pandoc $< -o $@
deploy: $(HTML_FILES)
scp $(HTML_FILES) $(SERVER):$(DEST_DIR)
.PHONY: deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment