Skip to content

Commit

Permalink
Update metadata-advanced.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
katydecorah committed Jun 20, 2024
1 parent 995bd11 commit 9ead0e9
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 24 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/metadata-advanced.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,29 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set post title and dates
id: set-season
run: |
# Get the current month and year
MONTH=$(date +%m)
YEAR=$(date +%Y)
# Define the seasons and corresponding emojis
declare -A SEASONS=(
["03"]="Winter"
["06"]="Spring"
["09"]="Summer"
["12"]="Fall"
)
set_env_vars() {
declare -A SEASON_EMOJI=(
["Winter"]="❄️"
["Spring"]="🌷"
["Summer"]="☀️"
["Fall"]="🍂"
)
# Function to set environment variables based on the season
set_environment_variables_for_season() {
local season=$1
local start_date=$2
local end_date=$3
Expand All @@ -40,23 +51,29 @@ jobs:
post_title="${YEAR} ${season}"
fi
echo "POST_TITLE=${post_title}" >> $GITHUB_ENV
echo "START_DATE=${start_date}" >> $GITHUB_ENV
echo "END_DATE=${end_date}" >> $GITHUB_ENV
echo "POST_TITLE=${post_title}" >> $GITHUB_OUTPUT
echo "START_DATE=${start_date}" >> $GITHUB_OUTPUT
echo "END_DATE=${end_date}" >> $GITHUB_OUTPUT
echo "SEASON_EMOJI=${SEASON_EMOJI[$season]}" >> $GITHUB_OUTPUT
}
# Set environment variables based on the current month
case $MONTH in
"03")
set_env_vars ${SEASONS[$MONTH]} "$(($YEAR - 1))-12-21" "${YEAR}-03-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "$(($YEAR - 1))-12-21" "${YEAR}-03-20"
;;
"06")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-03-21" "${YEAR}-06-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "${YEAR}-03-21" "${YEAR}-06-20"
;;
"09")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-06-21" "${YEAR}-09-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "${YEAR}-06-21" "${YEAR}-09-20"
;;
"12")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-09-21" "${YEAR}-12-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "${YEAR}-09-21" "${YEAR}-12-20"
;;
*)
echo "Invalid month: $MONTH" >&2
exit 1
;;
esac
- name: Write metadata post
Expand All @@ -66,15 +83,15 @@ jobs:
github-repository: sample-site
source-bookmarks: recipes|_data/recipes.json
book-tags: "recommend,skip"
start-date: ${{ env.START_DATE }}
end-date: ${{ env.END_DATE }}
post-title: ${{ env.POST_TITLE }}
start-date: ${{ steps.set-season.outputs.START_DATE }}
end-date: ${{ steps.set-season.outputs.END_DATE }}
post-title: ${{ steps.set-season.outputs.POST_TITLE }}
env:
TOKEN: ${{ secrets.TOKEN }}
- name: Commit files
run: |
git pull
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A && git commit -m "${{ env.POST_TITLE }}"
git add -A && git commit -m "${{steps.set-season.outputs.SEASON_EMOJI}} ${{ steps.set-season.outputs.POST_TITLE }}"
git push
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,29 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Set post title and dates
id: set-season
run: |
# Get the current month and year
MONTH=$(date +%m)
YEAR=$(date +%Y)
# Define the seasons and corresponding emojis
declare -A SEASONS=(
["03"]="Winter"
["06"]="Spring"
["09"]="Summer"
["12"]="Fall"
)
set_env_vars() {
declare -A SEASON_EMOJI=(
["Winter"]="❄️"
["Spring"]="🌷"
["Summer"]="☀️"
["Fall"]="🍂"
)
# Function to set environment variables based on the season
set_environment_variables_for_season() {
local season=$1
local start_date=$2
local end_date=$3
Expand All @@ -102,23 +113,29 @@ jobs:
post_title="${YEAR} ${season}"
fi
echo "POST_TITLE=${post_title}" >> $GITHUB_ENV
echo "START_DATE=${start_date}" >> $GITHUB_ENV
echo "END_DATE=${end_date}" >> $GITHUB_ENV
echo "POST_TITLE=${post_title}" >> $GITHUB_OUTPUT
echo "START_DATE=${start_date}" >> $GITHUB_OUTPUT
echo "END_DATE=${end_date}" >> $GITHUB_OUTPUT
echo "SEASON_EMOJI=${SEASON_EMOJI[$season]}" >> $GITHUB_OUTPUT
}
# Set environment variables based on the current month
case $MONTH in
"03")
set_env_vars ${SEASONS[$MONTH]} "$(($YEAR - 1))-12-21" "${YEAR}-03-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "$(($YEAR - 1))-12-21" "${YEAR}-03-20"
;;
"06")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-03-21" "${YEAR}-06-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "${YEAR}-03-21" "${YEAR}-06-20"
;;
"09")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-06-21" "${YEAR}-09-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "${YEAR}-06-21" "${YEAR}-09-20"
;;
"12")
set_env_vars ${SEASONS[$MONTH]} "${YEAR}-09-21" "${YEAR}-12-20"
set_environment_variables_for_season ${SEASONS[$MONTH]} "${YEAR}-09-21" "${YEAR}-12-20"
;;
*)
echo "Invalid month: $MONTH" >&2
exit 1
;;
esac
- name: Write metadata post
Expand All @@ -128,17 +145,17 @@ jobs:
github-repository: sample-site
source-bookmarks: recipes|_data/recipes.json
book-tags: "recommend,skip"
start-date: ${{ env.START_DATE }}
end-date: ${{ env.END_DATE }}
post-title: ${{ env.POST_TITLE }}
start-date: ${{ steps.set-season.outputs.START_DATE }}
end-date: ${{ steps.set-season.outputs.END_DATE }}
post-title: ${{ steps.set-season.outputs.POST_TITLE }}
env:
TOKEN: ${{ secrets.TOKEN }}
- name: Commit files
run: |
git pull
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A && git commit -m "${{ env.POST_TITLE }}"
git add -A && git commit -m "${{steps.set-season.outputs.SEASON_EMOJI}} ${{ steps.set-season.outputs.POST_TITLE }}"
git push
```
Expand Down
68 changes: 68 additions & 0 deletions notes/_posts/2024-06-20-2024-spring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
title: 2024 Spring
image: 2024-spring.png
books:
- title: How Infrastructure Works
authors: Deb Chachra, Kathe Mazur
url: https://share.libbyapp.com/title/9611909
tags:
- recommend
- title: Checkout 19
authors: Claire-Louise Bennett, Claire-Louise Bennett
url: https://share.libbyapp.com/title/6359846
- title: On Earth as It Is on Television
authors: Emily Jane, Hayden Bishop
url: https://share.libbyapp.com/title/9862410
- title: Mr. Penumbra's 24-Hour Bookstore
authors: Robin Sloan
url: https://share.libbyapp.com/title/1052742

recipes:
- title: Shrimp Tacos Recipe
site: NYT Cooking
url: https://cooking.nytimes.com/recipes/1023929-shrimp-tacos
image: bookmark-shrimp-tacos-recipe.jpg
- title: Pico de Gallo Recipe
site: NYT Cooking
url: https://cooking.nytimes.com/recipes/1023522-pico-de-gallo
image: bookmark-pico-de-gallo-recipe.jpg
- title: Simple Guacamole Recipe
site: NYT Cooking
url: https://cooking.nytimes.com/recipes/1023223-simple-guacamole
image: bookmark-simple-guacamole-recipe.jpg

playlist: 2024 Spring
spotify: https://open.spotify.com/link
tracks:
- track: Title 1
artist: Artist 1
album: Album 1
- track: Title 2
artist: Artist 2
album: Album 2
- track: Title 3
artist: Artist 3
album: Album 3

---

The books I read, playlist I made, and bookmarks I saved during 2024 Spring.

## Books

- [How Infrastructure Works](https://share.libbyapp.com/title/9611909) - Deb Chachra, Kathe Mazur (recommend)
- [Checkout 19](https://share.libbyapp.com/title/6359846) - Claire-Louise Bennett, Claire-Louise Bennett
- [On Earth as It Is on Television](https://share.libbyapp.com/title/9862410) - Emily Jane, Hayden Bishop
- [Mr. Penumbra's 24-Hour Bookstore](https://share.libbyapp.com/title/1052742) - Robin Sloan

## Playlist

- Title 1 - Artist 1
- Title 2 - Artist 2
- Title 3 - Artist 3

## Bookmarks

- [Shrimp Tacos Recipe](https://cooking.nytimes.com/recipes/1023929-shrimp-tacos) - NYT Cooking
- [Pico de Gallo Recipe](https://cooking.nytimes.com/recipes/1023522-pico-de-gallo) - NYT Cooking
- [Simple Guacamole Recipe](https://cooking.nytimes.com/recipes/1023223-simple-guacamole) - NYT Cooking

0 comments on commit 9ead0e9

Please sign in to comment.