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

feat: ✨ use manifest from latest valid github release for BRAT #93

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

johannrichard
Copy link

@johannrichard johannrichard commented Dec 29, 2024

I recently started to use semantic-release and the excellent brianrodri/semantic-release-obsidian-plugin which allows using semantic-release for Obsidian plugins (which can even be run locally, as no CI environment is needed).

One of the issues I ran into was the way how BRAT looks for (beta) releases in a repository, which is incompatible with development of new versions via dedicated branches and (pre-)releases built from these.

With this PR, I aim to propose to change the way how BRAT detects (Beta) Versions of plugins, and to base it on up-to-date information taken from the list of releases:

  • It either downloads a specific version (independently of whether it is defined as “pre-release” or not), or
  • downloads the latest version available as a release, giving priority to the highest version number according to the semantic version rules

Specifically, it will fetch the manifest.json from the latest (pre-) release in the repository to install and update plugins.

This makes BRAT independent of the version numbering in the repository root, and allows developers to use semantic-release and beta branches to develop pre-releases that all work with BRAT.

BREAKING: manifest-beta.json is not necessary anymore, although having it in a repository doesn't hurt at all. IMHO the change is still backwards-compatible with the old way.

As far as I can tell, Obsidian and plugins like the Obsidian plugin tracker currently look at the master manifest.json in the default branch of a plugin repository when updating plugins, which is also compatible with this change. If a developer releases a “beta” version as an independent but “full” release in his repository (e.g. by manually creating it), BRAT will pick it up independently of the version number in the master mainfest.json.

Furthermore, this change might also solve #81 and help with #61 as BRAT will download the latest official release automatically if there is no newer pre-release.

Finally, it will also make BRAT more robust, as it will always use the true release list as its source of truth.

See brianrodri/semantic-release-obsidian-plugin#1 for a patch that would build and commit a pre-release from pre-release branches (beta and similar).

Also note that there is an inconsistency in Obsidian's Plugin doc vis-à-vis version numbers: They reference Semantic Versioning but insist that versions can “only use numbers and periods (.)”. Semantic beta version numbers also contain dashes (e.g. 1.2.3-beta.1). I'd argue the latter is valid and therefore can also be used for Obsidian plugin versions, at least while developing.

- fetch the `manifest.json` from the latest (pre-) release in the repository to install and update plugins,
- this makes BRAT independent from the version numbering in the repository root, and
- this allows developers to use `semantic-release` and `beta` branches to develop pre-releases

BREAKING: `manifest-beta.json` is not necessary anymore
- ensure fixed version number is honored when validating (and downloading) `mainfest.json` from specific release
johannrichard and others added 2 commits December 29, 2024 17:20
- authenticated requests get a higher rate limit
…nd `package-lock.json` to 1.0.0-use-github-releases.1 [skip ci]

# 1.0.0-use-github-releases.1 (2025-01-01)

### Bug Fixes

* 🐛 ensure we specify version when validating repository ([8df9c4a](8df9c4a))

### Features

* ✨ use manifest from latest valid github release for BRAT ([bef31d8](bef31d8))
* access for private repo ([d86a6af](d86a6af))

### Performance Improvements

* ⚡️ use authentication whenever available ([e1ba0cc](e1ba0cc))
johannrichard added a commit to johannrichard/semantic-release-obsidian-plugin that referenced this pull request Jan 1, 2025
TODO(TfTHacker/obsidian42-brat#93): Make sure to remove code if BRAT integrates changes to use GitHub pre-releases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants