feat: Add repository host Codeberg (#2202)

This commit is contained in:
Remo Senekowitsch 2025-06-20 13:37:49 +02:00 committed by GitHub
parent 4628235403
commit a90dd4569f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 2 deletions

View file

@ -82,8 +82,8 @@ on windows and empty on other platforms).
The default value for `pkg-url` will depend on the repository of the package. The default value for `pkg-url` will depend on the repository of the package.
It is set up to work with GitHub releases, GitLab releases, bitbucket downloads It is set up to work with GitHub releases, GitLab releases, bitbucket downloads,
and source forge downloads. source forge downloads and Codeberg releases.
If your package already uses any of these URLs, you shouldn't need to set anything. If your package already uses any of these URLs, you shouldn't need to set anything.
@ -139,6 +139,11 @@ The URLs also have `/download` appended as per SourceForge's schema.
Binary must be uploaded to the "File" page of your project, under the directory Binary must be uploaded to the "File" page of your project, under the directory
`binaries/v{ version }`. `binaries/v{ version }`.
#### for Codeberg
- `{ repo }/releases/download/{ version }/`
- `{ repo }/releases/download/v{ version }/`
#### Others #### Others
For all other situations, `binstall` does not provide a default `pkg-url` and For all other situations, `binstall` does not provide a default `pkg-url` and

View file

@ -9,6 +9,7 @@ pub enum RepositoryHost {
GitLab, GitLab,
BitBucket, BitBucket,
SourceForge, SourceForge,
Codeberg,
Unknown, Unknown,
} }
@ -65,6 +66,7 @@ impl RepositoryHost {
Some(domain) if domain.starts_with("gitlab") => GitLab, Some(domain) if domain.starts_with("gitlab") => GitLab,
Some("bitbucket.org") => BitBucket, Some("bitbucket.org") => BitBucket,
Some("sourceforge.net") => SourceForge, Some("sourceforge.net") => SourceForge,
Some("codeberg.org") => Codeberg,
_ => Unknown, _ => Unknown,
} }
} }
@ -95,6 +97,12 @@ impl RepositoryHost {
&[FULL_FILENAMES, NOVERSION_FILENAMES], &[FULL_FILENAMES, NOVERSION_FILENAMES],
"/download", "/download",
)), )),
Codeberg => Some(apply_filenames_to_paths(
// Codeberg (Forgejo) has the same release paths as GitHub.
GITHUB_RELEASE_PATHS,
&[FULL_FILENAMES, NOVERSION_FILENAMES],
"",
)),
Unknown => None, Unknown => None,
} }
} }

View file

@ -290,6 +290,7 @@ impl RepoInfo {
match repository_host { match repository_host {
RepositoryHost::GitHub => Self::detect_subcrate_common(repo, &["tree"]), RepositoryHost::GitHub => Self::detect_subcrate_common(repo, &["tree"]),
RepositoryHost::GitLab => Self::detect_subcrate_common(repo, &["-", "blob"]), RepositoryHost::GitLab => Self::detect_subcrate_common(repo, &["-", "blob"]),
RepositoryHost::Codeberg => Self::detect_subcrate_common(repo, &["src", "branch"]),
_ => None, _ => None,
} }
} }

View file

@ -33,6 +33,9 @@ export PATH="$CARGO_HOME/bin:$PATH"
# #
#[ "$cargo_binstall_version" = "cargo-binstall 0.12.0" ] #[ "$cargo_binstall_version" = "cargo-binstall 0.12.0" ]
# Do not test Codeberg, it is donation funded and shouldn't be burdened with
# unnecessary traffic.
# Test default Github pkg-url templates, # Test default Github pkg-url templates,
# with bin-dir provided # with bin-dir provided
"./$1" binstall \ "./$1" binstall \