Skip to content

Commit e5ac799

Browse files
add fetch images workflow
1 parent 96a0305 commit e5ac799

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/fetch.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Fetch Images
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
UNSPLASH_ACCESS_KEY: ${{ secrets.UNSPLASH_ACCESS_KEY }}
8+
UNSPLASH_COLLECTION_ID: ${{ vars.UNSPLASH_COLLECTION_ID }}
9+
10+
jobs:
11+
dist:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Setup Node
17+
uses: actions/setup-node@v6
18+
with:
19+
node-version: 24
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
- name: Install
23+
run: npm ci
24+
- name: Fetch
25+
run: bash fetch.sh
26+
- name: Commit and push
27+
run: git add -A && git commit -m "update images" && git push origin

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: GitHub Pages
33
on:
44
workflow_dispatch:
55
push:
6+
workflow_run:
7+
workflows: [Fetch Images]
8+
types:
9+
- completed
610

711
jobs:
812
build-deploy:

fetch.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
. .env
5+
if [ -f ".env" ]; then
6+
. .env
7+
fi
68

79
OUTPUT_DIR=./images
810
MAX_HEIGHT=1000

0 commit comments

Comments
 (0)