-
Notifications
You must be signed in to change notification settings - Fork 19
119 lines (103 loc) · 3.71 KB
/
syndicate-content.yml
File metadata and controls
119 lines (103 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Syndicate Content to Social Media
on:
# Webhook trigger from Netlify after successful deploy
repository_dispatch:
types: [netlify-deploy-succeeded]
# Manual trigger for testing
workflow_dispatch:
inputs:
content_type:
description: "Content type to syndicate"
required: false
default: "both"
type: choice
options:
- posts
- links
- both
test_mode:
description: "Run in test mode (no actual posts)"
required: false
default: false
type: boolean
siteName:
description: "Netlify site name (auto-populated)"
required: false
default: ""
type: string
deployPrimeUrl:
description: "Netlify deploy preview URL"
required: false
default: ""
type: string
commit:
description: "Commit SHA for the deploy"
required: false
default: ""
type: string
# Scheduled daily check at 11am UTC
schedule:
- cron: "0 11 * * *"
jobs:
syndicate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
# Only install the minimal dependencies needed for syndication
npm install node-fetch@3 html-to-text
- name: Setup environment
run: |
echo "SITE_URL=https://www.aaron-gustafson.com" >> $GITHUB_ENV
echo "POSTS_FEED_URL=https://www.aaron-gustafson.com/feeds/latest-posts.json" >> $GITHUB_ENV
echo "LINKS_FEED_URL=https://www.aaron-gustafson.com/feeds/latest-links.json" >> $GITHUB_ENV
echo "TEST_MODE=${{ github.event.inputs.test_mode || 'false' }}" >> $GITHUB_ENV
# Restore cache before processing to avoid duplicates
- name: Restore processed items cache
uses: actions/cache/restore@v4
with:
path: .github/cache
key: syndication-cache-${{ github.sha }}
restore-keys: |
syndication-cache-
# Check for new posts
- name: Syndicate Posts
if: github.event.inputs.content_type != 'links'
run: node .github/scripts/syndicate-posts.js
env:
# Mastodon API
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_SERVER_URL: ${{ secrets.MASTODON_SERVER_URL }}
# Buffer API for Twitter/Bluesky
BUFFER_ACCESS_TOKEN: ${{ secrets.BUFFER_ACCESS_TOKEN }}
BUFFER_TWITTER_PROFILE_ID: ${{ secrets.BUFFER_TWITTER_PROFILE_ID }}
BUFFER_BLUESKY_PROFILE_ID: ${{ secrets.BUFFER_BLUESKY_PROFILE_ID }}
# IFTTT Webhook (fallback)
IFTTT_KEY: ${{ secrets.IFTTT_KEY }}
# Check for new links
- name: Syndicate Links
if: github.event.inputs.content_type != 'posts'
run: node .github/scripts/syndicate-links.js
env:
# Mastodon API
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
MASTODON_SERVER_URL: ${{ secrets.MASTODON_SERVER_URL }}
# Buffer API for Twitter/Bluesky
BUFFER_ACCESS_TOKEN: ${{ secrets.BUFFER_ACCESS_TOKEN }}
BUFFER_TWITTER_PROFILE_ID: ${{ secrets.BUFFER_TWITTER_PROFILE_ID }}
BUFFER_BLUESKY_PROFILE_ID: ${{ secrets.BUFFER_BLUESKY_PROFILE_ID }}
# IFTTT Webhook (fallback)
IFTTT_KEY: ${{ secrets.IFTTT_KEY }}
# Save updated cache after processing
- name: Save processed items cache
uses: actions/cache/save@v4
if: always()
with:
path: .github/cache
key: syndication-cache-${{ github.sha }}