-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add support for Zotero 7 #63
Conversation
Reviewed-by: Stefan Weil <[email protected]>
Zotero 7 can use the image files from Zotero 6, so remove the duplicates. Remove also whitespace at line endings Signed-off-by: Stefan Weil <[email protected]>
In the last commit I updated the version to 1.0.0. This is to be discussed. Would you prefer a minor step to 0.7.0? |
Open known issues:
|
Considering the observed issues, I am not 100% sure it deserves 1.0.0, but the choice is yours :-) |
I think you are right, so the last commit needs an update before this PR gets merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for all these work @stweil and @aborel ! That looks fine for me in general and I tested it in Zotero 7 as well. I have only some questions and small suggestions here.
As for the version number, I would also prefer to have 0.7.0 instead of 1.0.0. The design of the functionalities is for me not so clearly fixed yet and therefore I don't feel that it is already time for the 1.0.0.
I suggest to have the version here for Zotero 6 and 7, but then the focus on Zotero 7 only in the continuation. E.g. there is IMO no need to work on a bootstrap version for Zotero 6. We should just make sure that people with Zotero 6 and 7 can update to this newer version and from then on update even further for future version with Zotero 7. I guess we can do that with two entries in the updates.json.
updates.json.tmpl
Outdated
"update_link": "https://github.com/UB-Mannheim/zotero-ocr/releases/tag/0.0.0/zotero-ocr-0.0.0.xpi", | ||
"update_hash": "sha256:0000000000000000000000000000000000000000000000000000000000000000", | ||
"applications": { | ||
"gecko": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what is this tmpl file needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template file is used by release.sh
to create a new updates.json
(and its copy for Zotero 6).
release.sh
Outdated
|
||
jq ".addons[\"[email protected]\"].updates[0].version = \"${version}\"" updates.json.tmpl | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you change the version number in the updates.json
file instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that line is part of a command chain which writes a new updates.json
. The input for that comes from the template updates.json.tmpl
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My code was inspired by https://github.com/zotero/make-it-red/blob/main/make-zips.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can try the release process locally:
- Run
./release.sh 0.7.0
Then release it on GitHub:
- Run
git push origin 0.7.0
- Create new release for 0.7.0 on GitHub
- Update the locally built
zotero-ocr-0.7.0.xpi
as asset for the new release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I see now that jq
don't do the changes in-file and therefore a temporary file is needed.
I find these lines a little hard to read and suggest therefore some simplification, like:
jq '.addons["[email protected]"].updates[0].version = "${version}" |
.addons["[email protected]"].updates[0].update_link = "https://github.com/UB-Mannheim/zotero-ocr/releases/tag/${version}/zotero-ocr-${version}.xpi" |
.addons["[email protected]"].updates[0].update_hash = "sha256:$(shasum -a 256 build/zotero-ocr-${version}.xpi | cut -d\' \' -f1)"' update-extract.json.tmpl \
> update.json.tmpl
cp update.json.tmpl update.json
rm update.json.tmpl
Moreover, we don't need to commit the temporary file. It should be fine to create this every time and then delete it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updates.tmpl
is not a temporary file. It is a template file which is read as input by jq. In your code jq will read from STDIN
because the first jq command has no file argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but we can read this information from the actual updates,json
. Thus my corrected suggestion would be:
# update information in update.json using a temporarily file
jq '.addons["[email protected]"].updates[0].version = "${version}" |
.addons["[email protected]"].updates[0].update_link = "https://github.com/UB-Mannheim/zotero-ocr/releases/tag/${version}/zotero-ocr-${version}.xpi" |
.addons["[email protected]"].updates[0].update_hash = "sha256:$(shasum -a 256 build/zotero-ocr-${version}.xpi | cut -d\' \' -f1)"' update-extract.json.tmpl \
update.json > update.json.tmpl
cp update.json.tmpl update.json
rm update.json.tmpl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modified version might work:
# update information in update.json using a temporarily file
jq '.addons["[email protected]"].updates[0].version = "${version}" updates.json |
.addons["[email protected]"].updates[0].update_link = "https://github.com/UB-Mannheim/zotero-ocr/releases/tag/${version}/zotero-ocr-${version}.xpi" |
.addons["[email protected]"].updates[0].update_hash = "sha256:$(shasum -a 256 build/zotero-ocr-${version}.xpi | cut -d\' \' -f1)"' > updates.json.tmp
cp updates.json.tmp updates.json
rm updates.json.tmp
It requires five commands instead of three, but does not require an additional template file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jq could also be replaced by perl or sed which allow inline edits, so also can do the job without an additional template or temporary file. But that are cosmetic details without an effect on the resulting plug-in.
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: Zotero OCR plugin (zipped) | ||
path: "*.xpi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we could do this without zipping the xpi file, that would be easier to handle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but that's how GitHub handles artifacts. "There is currently no way to download artifacts in a format other than a Zip or to download individual artifact contents" (see https://github.com/actions/upload-artifact#zip-archives).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could upload the files which make up a xpi file. Then upload-artifacts would create a zip file, but that would not simplify the handling for users: they would have to rename the downloaded zip file to get an xpi file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am wrong, but can't these action also handle an individual file upload? https://github.com/actions/upload-artifact?tab=readme-ov-file#upload-an-individual-file We just need to upload the xpi file which is an individual file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De facto it is an individual file upload, because "*.xpi" is only a single file.
src/install.rdf
Outdated
@@ -6,8 +6,7 @@ | |||
RDF:about="urn:mozilla:install-manifest" | |||
em:id="[email protected]" | |||
em:name="Zotero OCR" | |||
em:version="0.6.0" | |||
em:type="2" | |||
em:version="1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below here in the install.rdf you need to increase the minVersion to 6.0 twice, as the json-style update works as far as we know from then on only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint. That's done now.
- remove failing commands - now allows version argument - update files for Zotero 6 and Zotero 7 - create annotated tag for release Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
I now replaced the |
Signed-off-by: Stefan Weil <[email protected]>
Signed-off-by: Stefan Weil <[email protected]>
This pull request adds support for Zotero 7 while still maintaining the support for Zotero 6. It is based on pull request #59. In addition it substitutes the pull requests #61 and #62 and includes some minor fixes and improvements.