Skip to main content
The Platform interface is the core abstraction for all platform implementations in MCReleaser. Each platform (GitHub, Modrinth, Hangar, etc.) implements this interface to provide upload functionality.

Package

me.hsgamer.mcreleaser.core.platform.Platform

Interface Declaration

public interface Platform {
    Optional<BatchRunnable> createUploadRunnable(FileBundle fileBundle);
}

Methods

createUploadRunnable

Creates a runnable task for uploading files to the platform.
fileBundle
FileBundle
required
The bundle of files to upload, containing a primary file and optional secondary files
Optional<BatchRunnable>
Optional<BatchRunnable>
Returns an Optional containing a BatchRunnable if the platform is properly configured, or an empty Optional if required properties are missing

Usage

Platform implementations validate required properties and return an empty Optional if configuration is missing:
@Override
public Optional<BatchRunnable> createUploadRunnable(FileBundle fileBundle) {
    if (PropertyKeyUtil.isAbsentAndAnnounce(logger, 
        GithubPropertyKey.TOKEN, 
        GithubPropertyKey.REPOSITORY, 
        GithubPropertyKey.REF)) {
        return Optional.empty();
    }
    
    BatchRunnable runnable = new BatchRunnable();
    // Configure upload tasks...
    return Optional.of(runnable);
}

Implementations

MCReleaser provides the following platform implementations:

Build docs developers (and LLMs) love