Skip to content

Commit c0a1044

Browse files
committed
chore(ci): add workflows for rebuilding the site and posting new links
1 parent 7529ced commit c0a1044

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Post New Blog to Bluesky
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'src/content/blog/**'
9+
schedule:
10+
# 8 AM Eastern: 13:00 UTC (EST) / 12:00 UTC (EDT)
11+
# Using 13:00 UTC = 8 AM EST, 9 AM EDT
12+
- cron: '0 13 * * *'
13+
workflow_dispatch:
14+
15+
jobs:
16+
detect:
17+
uses: CodingWithCalvin/.github/.github/workflows/detect-new-blog-post.yml@main
18+
with:
19+
content_path: 'src/content/blog'
20+
post_filename: 'index.md'
21+
site_url: 'https://www.codingwithcalvin.net'
22+
url_prefix: '/blog'
23+
event_name: ${{ github.event_name }}
24+
categories_field: 'categories'
25+
26+
notify:
27+
needs: detect
28+
if: needs.detect.outputs.has_new_post == 'true'
29+
uses: CodingWithCalvin/.github/.github/workflows/bluesky-post.yml@main
30+
with:
31+
post_text: |
32+
📝 New Blog Post!
33+
34+
[${{ needs.detect.outputs.post_title }}](${{ needs.detect.outputs.post_url }})
35+
36+
${{ needs.detect.outputs.post_hashtags }}
37+
secrets:
38+
BLUESKY_USERNAME: ${{ secrets.BLUESKY_USERNAME }}
39+
BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Scheduled Deploy
2+
3+
on:
4+
schedule:
5+
# Run at 7:50 AM Eastern (12:50 UTC) - 10 min before Bluesky post
6+
- cron: '50 12 * * *'
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
cache: npm
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Build site
26+
run: npm run build
27+
28+
- name: Deploy to Cloudflare
29+
uses: cloudflare/wrangler-action@v3
30+
with:
31+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
32+
command: deploy

0 commit comments

Comments
 (0)