class WarpEngine::Build::PublishController
Registers uploaded build artifacts as a release. Needs the update credential in X-Update-Secret (see WarpEngine::UpdateAuthentication).
Public Instance Methods
Source
# File app/controllers/warp_engine/build/publish_controller.rb, line 36 def create unless update_authorized?(required_scope: WarpEngine::ApplicationToken::UPDATE_SCOPE) return render json: { error: "Unauthorized" }, status: :unauthorized end input = WarpEngine::PublishInputDto.new( platform: params[:platform], name: params[:name], version: params[:version] ) return render json: { error: input.error_message }, status: :bad_request unless input.valid? unless software_ownership_authorized?(input.name) return render json: { error: "Forbidden" }, status: :forbidden end WarpEngine::PublishService.new.publish(input) claim_software_ownership(input.name) render json: { published: true, name: input.name, platform: input.platform, version: input.version } rescue WarpEngine::Platforms::MissingAssetsError => e render json: { error: e.message, missing: e.kinds }, status: :unprocessable_content rescue WarpEngine::PublishService::StaleVersionError => e render json: { error: e.message }, status: :conflict end
POST /build/publish.
- name
-
the software name
- platform
-
one of
WarpEngine::Platform.names - version
-
the version string
Validates the input (WarpEngine::PublishInputDto), publishes through WarpEngine::PublishService (creating or updating the software, its release and release assets) and gives an unowned software to the tokenβs owner. Renders { "published": true, "name", "platform", "version" }. Responds 401 without a valid credential, 400 for invalid input, 403 when the token does not own the software, 422 with missing kinds when a required asset was not uploaded, and 409 when a newer version is published.