ckeditor / ckeditor4-presets

CKEditor 4 presets builder.
18 stars 27 forks source link

Added scheduled update workflow #34

Closed f1ames closed 4 years ago

f1ames commented 4 years ago

I have added workflow file and script for updating ckeditor4 submodule regularly. It can be seen on the fork how and if it works - https://github.com/f1ames/ckeditor4-presets/actions/runs/58312837.

One important thing already mentioned in the parent task is that scheduled workflows are only run for default branch which means:

  1. Workflow files can be duplicated among branches but it will run only once from default (master in our case) branch.
  2. ~:point_up: Means we don't need to updated both master and major.~
  3. ~There is no issue with syncing script/workflow changes among branches.~

Well, point 2 and 3 are not entirely true. These will be true if the whole script would be inlined into workflow file. Now, since part of the script is in branch itself as a regular file there may be changes syncing issue. There are 3 solutions:

  1. The script file should be always synced between master and major (problematic IMHO and easy to forget).
  2. We can inline the whole logic into workflow file (easy, little more difficult to maintain).
  3. Script file should be copied from master and use also for major branch while running the workflow (looks kind of overcomplicated).

I'm for 2nd option, WDYT?

f1ames commented 4 years ago

And this is how it looks with inined script - https://github.com/f1ames/ckeditor4-presets/actions/runs/61845576.

IMHO it is a little unreadable (due to lack of syntax highlighting) and harder to edit/test so I was thinking if script could reside inside separate .sh file and then just inlined into workflow file (manually or just by running some script).

f1ames commented 4 years ago

I have inlined the script, let's see how it works.

Comandeer commented 4 years ago

I wonder if we need to create the workflow ourselves. There are already some ready-made GHAs that update submodules, e.g. https://github.com/textbook/git-checkout-submodule-action

f1ames commented 4 years ago

I wonder if we need to create the workflow ourselves. There are already some ready-made GHAs that update submodules, e.g. https://github.com/textbook/git-checkout-submodule-action

Good idea :+1: I covered it in https://github.com/f1ames/ckeditor4-presets/blob/f63fb33f6e482791d61fc16a7b87c503e5854e36/.github/workflows/update.yml, it looks better now (see in Actions), however it has another issue now. We need to use --remote flag to update to latest remote hash, however this will also update SCYAT/WSC submodules which we don't want to do... And I don't see any ready to use action which allows to update only selected submodules...

So we still need some custom code but thanks to submodule update action I was able to reduce it significantly.

f1ames commented 4 years ago

And then it turns out, this action fetches submodules as root (textbook/git-checkout-submodule-action#2) and custom script cannot update them https://github.com/f1ames/ckeditor4-presets/runs/591631852?check_suite_focus=true#step:5:13...

I could use git Actions instead as suggested, but it's still longer than simply calling git submodules update --init --recursive in run, so back to custom code :shrug:

f1ames commented 4 years ago

Here is action where everything is up-to-date (so nothing happens) - https://github.com/f1ames/ckeditor4-presets/actions/runs/79692945 and here where both master and major gets updated - https://github.com/f1ames/ckeditor4-presets/actions/runs/79686870.