Skip to content

Commit 2c28bbd

Browse files
committed
Add workflow to upload images to OCD CDN
1 parent 18d6696 commit 2c28bbd

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/update-cdn.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Update Open Coin Data CDN
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-seed:
10+
name: Update Open Coin Data CDN
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Open Coin Data
14+
uses: actions/checkout@v4
15+
with:
16+
repository: coinection/open-coin-data
17+
path: ocd
18+
fetch-depth: 0
19+
20+
- name: Checkout Coinection Scripts
21+
uses: actions/checkout@v4
22+
with:
23+
repository: coinection/coinection-scripts
24+
path: scripts
25+
token: ${{ secrets.ACCESS_TOKEN }}
26+
27+
- name: Determine if any images were updated
28+
run: |
29+
cd ./ocd
30+
31+
# Get all changed files in the PR and filter for those containing "Images".
32+
git fetch origin ${{ github.event.pull_request.base.ref }}
33+
git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD | grep "Images" > ../ocd/images.txt || true
34+
35+
# Remove duplicates and empty lines
36+
sort -u ../ocd/images.txt | sed '/^$/d' > ../ocd/images_temp.txt
37+
mv ../ocd/images_temp.txt ../ocd/images.txt
38+
if [ -s ../ocd/images.txt ]; then
39+
echo "Image files were updated:"
40+
cat ../ocd/images.txt
41+
else
42+
echo "No image files were updated."
43+
exit 0
44+
fi
45+
46+
- name: Run CDN Update Script
47+
run: |
48+
cd ./scripts
49+
npm install
50+
npm run update-cdn-images

0 commit comments

Comments
 (0)