Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import new Base images from media library #1

Closed
josecelano opened this issue Oct 15, 2021 · 2 comments · Fixed by #2
Closed

Import new Base images from media library #1

josecelano opened this issue Oct 15, 2021 · 2 comments · Fixed by #2
Labels
enhancement New feature or request
Milestone

Comments

@josecelano
Copy link
Member

Right now the current workflow only uses the images that are already inside the data folder.

The data folder contains tif images that were manually copied to this repo using [dvc](https://dvc.org/)

data/
├── 000001
│   └── 32
│       ├── 000001-32.600.2.tif
│       └── 000001-32.600.2.tif.dvc
└── 000002
    └── 32
        ├── 000002-32.600.2.tif
        └── 000002-32.600.2.tif.dvc

We got the images from this media library: https://github.com/Nautilus-Cyberneering/chinese-ideographs

You can deploy the application using the script: npm run deploy. That command executes the script ./scripts/copy-images.sh which copies the images from the data folder to the public\images folder.

public/images/
├── 000001-32.600.2.tif
└── 000002-32.600.2.tif

Those are the images that are shown on the website: https://nautilus-cyberneering.github.io/chinese-ideographs-website/

We want to update the website when new images are added to the source library. For this first iteration we are going to use this solution:

  1. We create two different workflows: deploy.yml and import-base-images.yml
  2. The new workflow (import-base-images.yml) is going to git clone the library and auto-commit new Base images in public/images/ folder.
  3. The current workflow (deploy.yml) will be modified to only build and deploy the website using gh-pages.

The deploy workflow will:

  1. checkout the website repo
  2. build app
  3. deploy to gh-pages

And the import-base-images.yml workflow will:

  1. checkout the library repo in a subfolder (gitignored). It will be the current data folder, but maybe something like: library\data\...
  2. dvc pull all images in the sub git project (we are not going to use git submodules or git subtrees for the time being, although maybe it worths considering it).
  3. copy images from the library to the repo folder (public\images)
  4. auto-commit new images
  5. Trigger deploy.yml workflow to publish the new version of the website on gh-pages. If this step is complicated for the POC we can simply repeat the steps needed to publish the website on this workflow.

The reasons to have two workflows are:

  • We want to have a simpler workflow if we only change the website source code (JS, CSS) but not the images.
  • In the future, we want to improve the import workflow. We want to trigger it from the library repo and we want to pass it an event payload, which does not make sense for the standard deploy.

Future improvements:

  • Run import-base-images.yml workflow on-demand only when Base images change in the library repo. We could trigger a workflow on the website repo from the library repo using GitHub API: https://github.com/marketplace/actions/repository-dispatch
  • Avoid pulling all images with dvc. In the previous trigger, we can set a payload for the event with the list of changed Base images. So we only need to process those files.
@josecelano josecelano added the enhancement New feature or request label Oct 15, 2021
@josecelano josecelano added this to the POC01 milestone Oct 15, 2021
josecelano added a commit that referenced this issue Oct 18, 2021
@josecelano josecelano linked a pull request Oct 18, 2021 that will close this issue
josecelano added a commit that referenced this issue Oct 18, 2021
josecelano added a commit that referenced this issue Oct 18, 2021
@josecelano
Copy link
Member Author

I'm using git submodules and it seems to work fine in this case but I do not have a list of prons and cons yet versus using subtrees.

josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
josecelano added a commit that referenced this issue Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant