diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ab7b81d..a4bfa62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,10 @@ name: Build extensions # the newest build …/releases/download/latest/.zip # one fixed version …/releases/download/-v/-.zip # +# And the update check (an extension's "update_url"): +# …/releases/download/latest/.json = {version, url, notes} +# It names the newest version and the link of its fixed zip. +# # A version is released once. To release a change, raise "version" in the # extension's extension.json. The "latest" link is replaced on every push. on: @@ -87,8 +91,18 @@ jobs: tag="$key-v$version" if gh release view "$tag" >/dev/null 2>&1; then echo "$tag is already released: raise the version to release a change" + # a run that died between the release and its upload left no zip: + # the update file below would point at nothing + if ! gh release view "$tag" --json assets -q '.assets[].name' | grep -qx "$file.zip"; then + gh release upload "$tag" "$zip" + fi else gh release create "$tag" "$zip" --target "$GITHUB_SHA" \ --title "$key $version" --notes "Build of $key, version $version." fi + # what Sellrika's update check reads: only after the fixed zip exists + jq -n --arg version "$version" \ + --arg url "https://github.com/${GITHUB_REPOSITORY}/releases/download/$tag/$file.zip" \ + '{version: $version, url: $url, notes: ""}' > "$key.json" + gh release upload latest "$key.json" --clobber done diff --git a/README.md b/README.md index 21e88a6..8963730 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,9 @@ A version is released once. The `latest` link always holds the newest build. Keep `app_version` right: the Sellrika versions the extension runs on, like `">=1.1.4"`. Sellrika refuses a zip with no `app_version`, or one that does not fit the running app. Raise it when the extension starts to use something new of the app. + +Set `update_url` to `https://github.com/sellrika/extensions/releases/download/latest/.json`. +The build writes that file on every release. Sellrika reads it every 6 hours. +When it names a newer version, **Admin › Global Extensions** shows an update badge and an **Update** button. +A Sellrika that runs an older version with no `update_url` (Blogger 1.1.7 or older) never sees it. +Import a version that has `update_url` once by link. From then on, updates show on their own. diff --git a/blogger/extension.json b/blogger/extension.json index 127e155..2073bed 100644 --- a/blogger/extension.json +++ b/blogger/extension.json @@ -1,8 +1,9 @@ { "key": "blogger", "name": "name", - "version": "1.1.7", + "version": "1.1.8", "app_version": ">=1.1.4", + "update_url": "https://github.com/sellrika/extensions/releases/download/latest/blogger.json", "description": "description", "icon": "assets/icon.svg", "main": "index.ts",