Skip to content

Commit

Permalink
docs: content update
Browse files Browse the repository at this point in the history
  • Loading branch information
lotusk08 committed Nov 3, 2024
1 parent 9129e96 commit 1b10e2e
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/update_last_modified.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Update Last Modified Date and Deploy

on:
push:
branches:
- blog
workflow_dispatch:

jobs:
updateLastModified:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'

- name: Install dependencies
run: bundle install

- name: Update last_modified_at field
run: |
posts_dir="_posts"
for post_path in $(find "$posts_dir" -name "*.md"); do
commit_count=$(git rev-list --count HEAD "$post_path")
last_modified=$(git log -1 --pretty="%ad" --date=format:'%Y-%m-%d %H:%M %z' "$post_path" | xargs)
content=$(cat "$post_path")
if [[ "$content" =~ ^date:\ (.+) ]]; then
if [[ "$content" =~ ^last_modified_at: ]]; then
sed -i "s/^last_modified_at:.*/last_modified_at: $last_modified/" "$post_path"
elif [[ $commit_count -gt 1 ]]; then
sed -i "/^date: /a last_modified_at: $last_modified" "$post_path"
fi
fi
done
- name: Commit changes
run: |
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"
git add _posts/*.md
git commit -m "Update last_modified_at field in posts" || echo "No changes to commit"
deployToCloudflare:
runs-on: ubuntu-latest
needs: updateLastModified # Ensure this runs after the updateLastModified job

steps:
- name: Push changes
run: git push origin blog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@2
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: "stevehoang"
directory: "_site"
3 changes: 2 additions & 1 deletion .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@
},
"active": "5a896499c46a1e42",
"lastOpenFiles": [
"wrangler.toml",
"assets/img/site/tkt-website.webp",
"assets/img/site/tks-teams.webp",
"assets/img/site/tks-employee.webp",
"assets/img/site/tk-teams.webp",
"assets/img/site/TK-cover-profile.webp",
"assets/img/site/thai-khuong-song.webp",
"assets/img/site/stk-planning.webp",
"assets/img/site/real-time-report.webp",
Expand Down Expand Up @@ -270,6 +270,7 @@
"_posts/2021-09-18-san-pham-cong-dong.md",
"_posts/2021-07-15-an.md",
"_includes/analytics/fathom 2.html",
"wrangler.toml",
"_site/what-makes-you-happy/index.html",
"_site/what-makes-you-happy",
"_site/a-year-with-too/index.html",
Expand Down
2 changes: 0 additions & 2 deletions _posts/2024-10-22-what-makes-you-happy.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ mermaid: false
> What makes you happy?
{: .prompt-warning }

I paused for a moment when I saw this question. It’s strange—I can't even remember what used to matter most to me.

## People

As I searched online, I stumbled upon a few perspectives that resonated:
Expand Down

0 comments on commit 1b10e2e

Please sign in to comment.