-
Notifications
You must be signed in to change notification settings - Fork 2
146 lines (111 loc) · 3.21 KB
/
main.yml
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Post every 24 hours
on:
schedule:
- cron: "0 0 * * *" # every 24 hours
workflow_dispatch:
jobs:
create-post-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
working-directory: image_gen_PY
- name: Download Image Log file
uses: dawidd6/action-download-artifact@v9
with:
name: image_log
path: ./image_gen_PY/
if_no_artifact_found: warn
search_artifacts: true
- name: Run Python script
run: python image_gen.py
env:
UNSPLASH_CLIENT_ID: ${{ secrets.UNSPLASH_CLIENT_ID }}
working-directory: image_gen_PY
- name: Upload Image Log file
uses: actions/upload-artifact@v4
with:
name: image_log
path: ./image_gen_PY/image_log.txt
- name: Upload post image to artifact
uses: actions/upload-artifact@v4
with:
name: post_image
path: currentImage.png
deploy-website:
runs-on: ubuntu-latest
needs: create-post-image
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Check repository
uses: actions/checkout@v4
- name: Download post image
uses: actions/download-artifact@v4
with:
name: post_image
- name: Put post image into website
run: cp currentImage.png ./html/
- name: Upload website to artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./html
- name: Deploy website
id: web-deployment
uses: actions/deploy-pages@v4
post-to-bsky:
runs-on: ubuntu-latest
needs: create-post-image
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install npm dependencies
run: npm install
working-directory: bluesky_post_TS
- name: Download post image
uses: actions/download-artifact@v4
with:
name: post_image
- name: Create Bluesky post
run: npm run start
env:
BSKY_HANDLE: ${{ vars.BSKY_HANDLE }}
BSKY_PASSWORD: ${{ secrets.BSKY_PASSWORD }}
working-directory: bluesky_post_TS
post-to-threads:
runs-on: ubuntu-latest
needs: deploy-website
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
working-directory: threads_post_PY
- name: Create Threads post
run: python threads_post.py
env:
THREADS_USER_ID: ${{ secrets.THREADS_USER_ID }}
THREADS_ACCESS_TOKEN: ${{ secrets.THREADS_ACCESS_TOKEN }}
working-directory: threads_post_PY