imagej / imagej.github.io

The ImageJ wiki
https://imagej.net
Other
25 stars 110 forks source link

Update Update Site Uploads for Github Actions #195

Closed remiberthoz closed 2 years ago

remiberthoz commented 2 years ago

I duplicated the instructions for Tarvis CI automated uploads to update sites, adapting for GitHub Actions. The document structure is exactly the same, the main change is the .yml configuration file which has to be used.

Please observe however that I had to modify the script that performs the release. In the (older) Tarvis CI section, the bash commands are:

wget --no-check-certificate https://downloads.imagej.net/fiji/latest/fiji-linux64.zip  &&  unzip fiji-linux64.zip
mvn clean install -Dscijava.app.directory=$IJ_PATH -Ddelete.other.versions=true
$IJ_LAUNCHER --update edit-update-site $UPDATE_SITE $URL "webdav:$USER:$WIKI_UPLOAD_PASS" .
$IJ_LAUNCHER --update update
$IJ_LAUNCHER --update upload --update-site $UPDATE_SITE --force-shadow jars/YOUR-FILE.jar

whereas with GitHub Actions I suggest (adjusting slightly for readability here):

curl --silent $IJ_DOWNLOAD_URL | tar --extract --gzip
$IJ_LAUNCHER --update edit-update-site $UPDATE_SITE $URL "webdav:$USER:$WIKI_UPLOAD_PASS" .
mvn -B install -Dscijava.app.directory=$IJ_PATH -Ddelete.other.versions=true -Dscijava.ignoreDependencies=true
$IJ_LAUNCHER --update upload-complete-site --force $UPDATE_SITE

The reason I had to change is that when testing on my side, I figured the steps indicated in the Tarvis CI section create dependency conflicts. I am not sure my fix is adequate, but I would be more than happy to correct it!

ctrueden commented 2 years ago

@remiberthoz Thanks a lot for working on this! And apologies for the delay in merge. Since you tested the changes you made, and they work for you, I'm going to merge this now.

Relatedly: support for deploying to maven.scijava.org via Travis CI currently needs some tweaks to account for recent security concerns there. I'll be trying to update the CI-related infrastructure and documentation today, so you might see additional edits to this and other pages on the wiki.

remiberthoz commented 2 years ago

Thanks! And no worries for the delay.

remiberthoz commented 2 years ago

Hi! I recently had to modify my GitHub Action for automated releases. We should probably include this change in the wiki, but I'm not sure my script is the safest/easiest.

Currently, the wiki says that one should run :

./Fiji.app/ImageJ-linux64 --headless --update upload-complete-site --force ${UPDATE_SITE}

but I think it is necessary to update ImageJ before:

./Fiji.app/ImageJ-linux64 --headless --update update
./Fiji.app/ImageJ-linux64 --headless --update upload-complete-site --force ${UPDATE_SITE}

I'm not sure about the upload-complete-site and --force. What do you think? I would like to gather a green light, before updating the wiki. Thanks!

imagejan commented 2 years ago

+1 for first updating before uploading.

FWIW, here is how it's done in Fiji:

https://github.com/fiji/fiji/blob/e4fc8ff7a772aaeb0b9f88ed8a50a7a7da7bd7ee/bin/upload-update-site.sh#L71-L72 https://github.com/fiji/fiji/blob/e4fc8ff7a772aaeb0b9f88ed8a50a7a7da7bd7ee/bin/upload-update-site.sh#L83-L97

Also, it seems --force-shadow is adequate:

https://github.com/scenerygraphics/sciview-update-sites/blob/6bd9b2b7ba4d02e958e30eb98e514d74f348c484/upload-site.sh#L39-L40

I'm pinging @kephale and @skalarproduktraum as they have extensive experience with automatic update site uploads, and what can go wrong with dependencies and natives 🙂

kephale commented 2 years ago

Sciview has a bunch of tooling to support this https://github.com/scenerygraphics/sciview. Happy to explain more if there are specific questions.

remiberthoz commented 2 years ago

Hi, @kephale do you know the difference between

? I could not find documentation on this topic, besides examples like @imagejan provided. It would be good to briefly describe what these commands do on the wiki page for Automatic Updates to Update Sites. So that users can chose what they need.

Thanks !

kephale commented 2 years ago

iirc, --force will upload and replace regardless if an alternative version of the artifact is there, and --force-shadow will upload an alternative jar that can be used in your plugin, but the shadowing stuff can get confusing and I might not be explaining it correctly.