update workflow triggers, add a script to create a blog entry.
All checks were successful
/ Build static site, docker image, upload artifact... (push) Successful in 6m36s
/ Connect to deployment host, update, and redeploy docs website. (push) Successful in 21s

This commit is contained in:
2024-10-26 03:11:18 -07:00
parent e398c00fd3
commit a030e42d19
2 changed files with 56 additions and 4 deletions

50
entry Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python3
import os
from datetime import datetime
# Get the current date and time
now = datetime.now()
year = now.strftime("%Y")
month = now.strftime("%m")
day = now.strftime("%d")
time_str = now.strftime("%H:%M")
time_str_sec = now.strftime("%H%M%S")
if str(day).endswith("1"): suffix = "st"
elif str(day).endswith("2"): suffix = "nd"
elif str(day).endswith("3"): suffix = "rd"
else: suffix = "th"
# Create the directory structure
directory = os.path.join("content", year, month, day)
os.makedirs(directory, exist_ok=True)
# Define the filename
filename = f"blog-entry-{time_str_sec}.md"
file_path = os.path.join(directory, filename)
print(file_path)
HEADER = f'''title:
description:
tags:
date: {year}-{month}-{day} {time_str}
# Blog Entry
'''
# Create the Markdown file and write the header
with open(file_path, 'a+') as file:
header = HEADER
file.write(header)
file.close()
print(f"Blog entry created: {file_path}")