Post 2024-04-22
All checks were successful
Deploy to Netlify / Deploy Hugo site to Netlify (push) Successful in 37s

This commit is contained in:
Alan Youngblood
2024-04-25 11:40:33 -04:00
parent c2ee920109
commit 45d65b5f3f
99 changed files with 1895 additions and 8 deletions

View File

@ -39,3 +39,18 @@ jobs:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
timeout-minutes: 1
- name: Post to Social Media
run: |
COMMIT=$(git log --oneline -1 --format=%s | sed 's/^.*: //')
PREFIX="Post "
if [[ "$COMMIT" == "$PREFIX"* ]]; then
SUBDIR=$(find content/posts -name "${COMMIT:5}*" -type d)
POST=${SUBDIR:14}
TITLE=$(awk -v pat="title" -F":" '$0 ~ pat {print $2}' $SUBDIR/index.md)
DESC=$(awk -v pat="description" -F":" '$0 ~ pat {print $2}' $SUBDIR/index.md)
echo "Posting the following to mastodon"
echo "Check out my latest blog post $TITLE about $DESC read more at https://allisthewave.com/posts/$POST"
curl https://fosstodon.org/api/v1/statuses -H 'Authorization: Bearer kdKxV9v4Cv-GwhAd5YHDqI6xJsKT4KkFX89FlhPvBzw' -F 'status=Check out my latest blog post $TITLE about $DESC read more at https://allisthewave.com/posts/$POST'
else
echo "The commit message is not in format 'Post YYYY-MM-DD' or failed to parse..."
fi