From 9ead0e9eaa62bd75da35752101aa9e40c38efd61 Mon Sep 17 00:00:00 2001 From: Katy DeCorah Date: Wed, 19 Jun 2024 20:21:50 -0400 Subject: [PATCH] Update metadata-advanced.yml --- .github/workflows/metadata-advanced.yml | 41 ++++++++++----- README.md | 41 ++++++++++----- notes/_posts/2024-06-20-2024-spring.md | 68 +++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 24 deletions(-) create mode 100644 notes/_posts/2024-06-20-2024-spring.md diff --git a/.github/workflows/metadata-advanced.yml b/.github/workflows/metadata-advanced.yml index 5b95e6d..0cf94f4 100644 --- a/.github/workflows/metadata-advanced.yml +++ b/.github/workflows/metadata-advanced.yml @@ -17,10 +17,13 @@ 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" @@ -28,7 +31,15 @@ jobs: ["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 @@ -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 @@ -66,9 +83,9 @@ 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 @@ -76,5 +93,5 @@ jobs: git pull git config --local user.email "action@github.com" 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 diff --git a/README.md b/README.md index 65d3a2b..0c16a0f 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,13 @@ 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" @@ -90,7 +93,15 @@ jobs: ["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 @@ -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 @@ -128,9 +145,9 @@ 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 @@ -138,7 +155,7 @@ jobs: git pull git config --local user.email "action@github.com" 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 ``` diff --git a/notes/_posts/2024-06-20-2024-spring.md b/notes/_posts/2024-06-20-2024-spring.md new file mode 100644 index 0000000..32bed35 --- /dev/null +++ b/notes/_posts/2024-06-20-2024-spring.md @@ -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