How to automate publishing Chrome extension to the

2019-03-09 07:52发布

问题:

Starting from Google Chrome 21.x private update sites won't be supported anymore. This forces us to move our extension to the Google Web store. Previously, we used an automatic script that created .crx file, signed it, and uploaded to the update site.

Is there a way to do script uploading extension to the Google Web store?

回答1:

Since March 2014, there is an API to do that. Documentation here.

I never worked with it, so I cannot provide a full example.

However, from the documentation, the basic flow would be an authenticated request with an updated package, followed by an authenticated request to publish:

> curl \
-H "Authorization: Bearer $TOKEN"  \
-H "x-goog-api-version: 2" \
-X PUT \
-T $FILE_NAME \
-v \
https://www.googleapis.com/upload/chromewebstore/v1.1/items/$APP_ID

> curl \
-H "Authorization: Bearer $TOKEN"  \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-X POST \
-v \
https://www.googleapis.com/chromewebstore/v1.1/items/$APP_ID/publish


回答2:

Here is my grunt plugin for this https://github.com/c301/grunt-webstore-upload.

But you still have to upload your extension first time, in order to get the extension id.

It solves only the uploading problem, you need to compile the ZIP file first. You can use this grunt plugin https://github.com/oncletom/grunt-crx ( I didn't test it ).



回答3:

Actually, you cannot do it because of security issue. But you can build your extension to zip file automatically, then you just upload that zip file to Google Web Store. That's all!