Skip to content
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

publii: update livecheck #203720

Merged
merged 1 commit into from
Mar 7, 2025
Merged

publii: update livecheck #203720

merged 1 commit into from
Mar 7, 2025

Conversation

khipp
Copy link
Member

@khipp khipp commented Mar 4, 2025

Important: Do not tick a checkbox if you haven’t performed its action. Honesty is indispensable for a smooth review process.

In the following questions <cask> is the token of the cask you're submitting.

After making any changes to a cask, existing or new, verify:

Additionally, if adding a new cask:

  • Named the cask according to the token reference.
  • Checked the cask was not already refused (add your cask's name to the end of the search field).
  • brew audit --cask --new <cask> worked successfully.
  • HOMEBREW_NO_INSTALL_FROM_API=1 brew install --cask <cask> worked successfully.
  • brew uninstall --cask <cask> worked successfully.

This PR removes the cask's checksum and captures the build number in the livecheck block, as upstream regularly releases new builds under the same version number:

@khipp khipp added the livecheck Issues or PRs related to livecheck label Mar 4, 2025
@khipp khipp force-pushed the update-publii branch 2 times, most recently from bd6b505 to 07db8cc Compare March 4, 2025 07:05
@toobuntu
Copy link
Contributor

toobuntu commented Mar 5, 2025

Based on a conversation I had with upstream (GetPublii/Publii#2075), I was exploring a different approach using builddata.json directly from the upstream repository, as it is updated automatically with every build and contains the latest version and build values. It’s also used by TopBarNotification.vue to display upgrade messages to the user, so it seemed like a reliable source for livecheck. I thought brew bump could handle updating the checksum automatically.

Here’s what I had in mind:

@@ -11,8 +11,12 @@ cask "publii" do
   homepage "https://getpublii.com/"
 
   livecheck do
-    url "https://getpublii.com/download/"
-    regex(/href=.*?Publii[._-]v?(\d+(?:\.\d+)+)(?:[._-]#{arch})?\.dmg/i)
+    url "https://raw.githubusercontent.com/GetPublii/Publii/refs/heads/master/app/back-end/builddata.json"
+    strategy :json do |json|
+      version = json["version"]
+      build = json["build"]
+      "#{version}+#{build}"
+    end
   end
 
   app "Publii.app"

Would something like this be worth considering as an alternative?

@khipp
Copy link
Member Author

khipp commented Mar 5, 2025

Would something like this be worth considering as an alternative?

Thanks, that’s worth a consideration. We should wait for the maintainer’s response, though.

Ideally, upstream would consider your suggestion to include the build number in the filename so that we could use checksums again.

Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
@toobuntu
Copy link
Contributor

toobuntu commented Mar 7, 2025

I looked a bit deeper into Publii's update mechanism and found that it uses the https://getpublii.com/notifications.json endpoint. This currently provides the latest version, build, and an update message:

[
   {
      "text": "A new build of Publii 0.46.4 is available! (Build 17047) <a href='https://getpublii.com/blog/release-046-4.html' target='_blank'>Check it out</a>",
      "timestamp": 1740833101000,
      "publiiMaxVersion": "0.46.3"
   }
]

The current PR works well with the download page, so I don’t want to hold it up. That said, using this endpoint for livecheck might be worth exploring as a follow-up.

I don't know how the endpoint is generated. If there’s any doubt about the build always being included, then relying on the timestamp might be more reliable.

Just wanted to share this as an idea to explore, especially if waiting on upstream feedback doesn’t provide further clarity.

@khipp
Copy link
Member Author

khipp commented Mar 7, 2025

Thank you! Let's merge this for now, and we can explore the other option once upstream provides more information.

@khipp khipp requested a review from samford March 7, 2025 13:15
@samford samford merged commit b56877e into master Mar 7, 2025
11 checks passed
@samford samford deleted the update-publii branch March 7, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
livecheck Issues or PRs related to livecheck
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants