diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index e9bacac..8d522bb 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -35,15 +35,3 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public - - # - name: dump github context - # env: - # GITHUB_CONTEXT: ${{ toJson(github) }} - # run: echo $GITHUB_CONTEXT - - - name: Purge Cloudflare cache - if: github.ref == 'refs/heads/main' - uses: jakejarvis/cloudflare-purge-action@master - env: - CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE_ID }} - CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2cad6f0 --- /dev/null +++ b/Makefile @@ -0,0 +1,63 @@ +.PHONY: help server build clean new draft deploy test + +# Default target +help: + @echo "Hugo Blog Makefile" + @echo "" + @echo "Available commands:" + @echo " make server - Start Hugo development server with drafts" + @echo " make build - Build the site for production" + @echo " make build-draft - Build the site including drafts" + @echo " make clean - Remove generated files (public/, resources/)" + @echo " make new POST=name - Create a new blog post" + @echo " make draft POST=name - Create a new draft post" + @echo " make deploy - Build and prepare for deployment" + @echo " make test - Test the build without publishing" + @echo "" + +# Start development server with drafts and live reload +server: + @echo "Starting Hugo development server..." + hugo server -D --bind 0.0.0.0 + +# Build the site for production +build: + @echo "Building site for production..." + hugo --minify + +# Build the site including drafts +build-draft: + @echo "Building site with drafts..." + hugo --minify -D + +# Remove generated files +clean: + @echo "Cleaning generated files..." + rm -rf public/ resources/ + +# Create a new post (usage: make new POST=my-post-name) +new: + @if [ -z "$(POST)" ]; then \ + echo "Error: POST variable is required. Usage: make new POST=my-post-name"; \ + exit 1; \ + fi + @echo "Creating new post: $(POST)" + hugo new posts/$(POST).md + +# Create a new draft post (usage: make draft POST=my-draft-post) +draft: + @if [ -z "$(POST)" ]; then \ + echo "Error: POST variable is required. Usage: make draft POST=my-draft-post"; \ + exit 1; \ + fi + @echo "Creating new draft post: $(POST)" + hugo new posts/$(POST).md + @echo "Note: Set 'draft: true' in the front matter if not already set" + +# Build and prepare for deployment +deploy: clean build + @echo "Site built and ready for deployment in ./public" + +# Test the build +test: clean build + @echo "Build test completed successfully" diff --git a/README.md b/README.md index 26f0036..042e787 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,107 @@ Simple things and stuff -## Ordinary workflows +## Prerequisites + +- [Hugo](https://gohugo.io/) (v0.154.5 or later) +- Make (optional, but recommended for easier workflow) + +## Quick Start + +### Using Make (Recommended) + +The repository includes a Makefile with common Hugo commands. Run `make help` to see all available commands: + +```bash +make help +``` + +### Common Commands + +#### Development + +Start the development server with live reload and draft posts enabled: + +```bash +make server +``` + +The site will be available at `http://localhost:1313` + +#### Creating Content + +Create a new blog post: + +```bash +make new POST=my-post-name +``` + +This creates a new post at `content/posts/my-post-name.md` + +#### Building + +Build the site for production: + +```bash +make build +``` + +Build including draft posts (for testing): + +```bash +make build-draft +``` + +Build and prepare for deployment (cleans first): + +```bash +make deploy +``` + +#### Maintenance + +Clean generated files: + +```bash +make clean +``` + +Test the build: + +```bash +make test +``` + +## Manual Commands (Without Make) + +If you prefer not to use Make, you can run Hugo commands directly: * Create a new post - * hugo new posts/post-name.md -* Start server - * hugo server -D -* Publish site locally - * hugo --minify -D + * `hugo new posts/post-name.md` +* Start development server + * `hugo server -D` +* Build for production + * `hugo --minify` +* Build with drafts + * `hugo --minify -D` + +## CI/CD + +The repository uses GitHub Actions for automated deployment: + +- Pushes to `main` branch trigger automatic builds +- Site is deployed to GitHub Pages +- Hugo version: 0.154.5 (extended) + +## Project Structure + +``` +. +├── archetypes/ # Content templates +├── content/ # Site content (posts, pages) +├── layouts/ # Custom HTML templates +├── static/ # Static assets (images, css, js) +├── themes/ # Hugo themes (git submodules) +├── config.toml # Hugo configuration +└── Makefile # Build automation +```