Skip to content

Commit

Permalink
Deploy API and images to separate paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba2k2 committed Oct 5, 2022
1 parent ea6fccc commit 87ff6b2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
25 changes: 9 additions & 16 deletions .github/workflows/gh-pages-api.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Deploy to GitHub Pages
name: Deploy API to GitHub Pages
on:
workflow_dispatch:
push:
branches:
- master
paths:
- devices/*.json
- profiles/*.json

concurrency: gh-pages-deployment
jobs:
deploy:
name: Deploy to GitHub Pages
Expand All @@ -21,21 +26,9 @@ jobs:
run: |
python generate_static_api.py
- name: Generate image thumbnails
uses: subic/ghaction-thumbnails@master
with:
source: images
output: site/images/thumbs
subfolder: false
sizes: 300x300
fit: outside

- name: Copy images to site directory
run: |
cp images/* site/images/
- name: Deploy to GitHub Pages
- name: Deploy API to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site
folder: site/api/
target-folder: api/
force: false
37 changes: 37 additions & 0 deletions .github/workflows/gh-pages-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Deploy images to GitHub Pages
on:
workflow_dispatch:
push:
branches:
- master
paths:
- images/*

concurrency: gh-pages-deployment
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Generate image thumbnails
uses: subic/ghaction-thumbnails@master
with:
source: images
output: site/images/thumbs
subfolder: false
sizes: 300x300
fit: outside

- name: Copy images to site directory
run: |
cp images/* site/images/
- name: Deploy images to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: site/images/
target-folder: images/
force: false
4 changes: 2 additions & 2 deletions generate_static_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def sort_list(obj: dict, key: str):
obj[key] = sorted(obj[key])


DIR_OUTPUT = "site"
DIR_OUTPUT = join("site", "api")
DIR_DEVICES = join(DIR_OUTPUT, "devices")
DIR_PROFILES = join(DIR_OUTPUT, "profiles")
IMAGES_URL = "https://tuya-cloudcutter.github.io/cloudcutter-data/images"
IMAGES_URL = "https://tuya-cloudcutter.github.io/images"

makedirs(DIR_DEVICES, exist_ok=True)
makedirs(DIR_PROFILES, exist_ok=True)
Expand Down

0 comments on commit 87ff6b2

Please sign in to comment.