diff --git a/SUPPORT.md b/SUPPORT.md index f18fd17f..453a8e43 100644 --- a/SUPPORT.md +++ b/SUPPORT.md @@ -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. -It is set up to work with GitHub releases, GitLab releases, bitbucket downloads -and source forge downloads. +It is set up to work with GitHub releases, GitLab releases, bitbucket downloads, +source forge downloads and Codeberg releases. 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 `binaries/v{ version }`. +#### for Codeberg + +- `{ repo }/releases/download/{ version }/` +- `{ repo }/releases/download/v{ version }/` + #### Others For all other situations, `binstall` does not provide a default `pkg-url` and diff --git a/crates/binstalk-fetchers/src/gh_crate_meta/hosting.rs b/crates/binstalk-fetchers/src/gh_crate_meta/hosting.rs index db8652a9..ddce60d6 100644 --- a/crates/binstalk-fetchers/src/gh_crate_meta/hosting.rs +++ b/crates/binstalk-fetchers/src/gh_crate_meta/hosting.rs @@ -9,6 +9,7 @@ pub enum RepositoryHost { GitLab, BitBucket, SourceForge, + Codeberg, Unknown, } @@ -65,6 +66,7 @@ impl RepositoryHost { Some(domain) if domain.starts_with("gitlab") => GitLab, Some("bitbucket.org") => BitBucket, Some("sourceforge.net") => SourceForge, + Some("codeberg.org") => Codeberg, _ => Unknown, } } @@ -95,6 +97,12 @@ impl RepositoryHost { &[FULL_FILENAMES, NOVERSION_FILENAMES], "/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, } } diff --git a/crates/binstalk-fetchers/src/lib.rs b/crates/binstalk-fetchers/src/lib.rs index 49a86894..99b2c653 100644 --- a/crates/binstalk-fetchers/src/lib.rs +++ b/crates/binstalk-fetchers/src/lib.rs @@ -290,6 +290,7 @@ impl RepoInfo { match repository_host { RepositoryHost::GitHub => Self::detect_subcrate_common(repo, &["tree"]), RepositoryHost::GitLab => Self::detect_subcrate_common(repo, &["-", "blob"]), + RepositoryHost::Codeberg => Self::detect_subcrate_common(repo, &["src", "branch"]), _ => None, } } diff --git a/e2e-tests/other-repos.sh b/e2e-tests/other-repos.sh index d492d126..dfde0f30 100755 --- a/e2e-tests/other-repos.sh +++ b/e2e-tests/other-repos.sh @@ -33,6 +33,9 @@ export PATH="$CARGO_HOME/bin:$PATH" # #[ "$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, # with bin-dir provided "./$1" binstall \