GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tememo/scripts/publish-post.sh at develop · anlt149/tememo

Expand file tree

/

publish-post.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
52 lines (38 loc) · 1.14 KB
/

publish-post.sh

Copy path

File metadata and controls

executable file
·
52 lines (38 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# Publish a blog post by staging, verifying, committing, and pushing.
if [ -z "$1" ]; then
echo "Usage: ./scripts/publish-post.sh <path-to-blog-post>"
echo "Example: ./scripts/publish-post.sh src/content/blog/my-new-post.md"
exit 1
fi
FILE="$1"
if [[ "$FILE" != /* ]]; then
FILE="$(pwd)/$FILE"
fi
if [ ! -f "$FILE" ]; then
echo "Error: File $FILE does not exist."
exit 1
fi
# Ensure we are in the root directory
cd "$(dirname "$0")/.." || exit 1
# Extract the title from the frontmatter for the commit message
TITLE=$(grep "^title:" "$FILE" | sed 's/^title: *//' | sed 's/^"//;s/"$//' | sed "s/^'//;s/'$//")
if [ -z "$TITLE" ]; then
TITLE=$(basename "$FILE")
fi
echo "Publishing: $TITLE"
# Stage the file so the verify script can pick it up
git add "$FILE"
# Run the verification script
echo "Running verification..."
./scripts/verify-blog-post.sh
if [ $? -ne 0 ]; then
echo "Verification failed. Unstaging $FILE..."
git restore --staged "$FILE"
exit 1
fi
echo "Verification passed. Committing..."
git commit -m "docs: publish post '$TITLE'"
echo "Pushing to remote..."
git push
echo "Successfully published '$TITLE'!"
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.