• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jreleaser / jreleaser / #475

03 Apr 2025 10:50AM UTC coverage: 40.322% (-8.9%) from 49.193%
#475

push

github

aalmiray
feat(release): Support Forgejo as releaser

Closes #1842

Closes #1843

182 of 1099 new or added lines in 45 files covered. (16.56%)

4239 existing lines in 333 files now uncovered.

20797 of 51577 relevant lines covered (40.32%)

0.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/core/jreleaser-engine/src/main/java/org/jreleaser/engine/upload/ProjectUploader.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 *
4
 * Copyright 2020-2025 The JReleaser authors.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     https://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
package org.jreleaser.engine.upload;
19

20
import org.jreleaser.bundle.RB;
21
import org.jreleaser.model.internal.JReleaserContext;
22
import org.jreleaser.model.internal.upload.Uploader;
23
import org.jreleaser.model.spi.upload.ArtifactUploader;
24
import org.jreleaser.model.spi.upload.UploadException;
25

26
import static java.util.Objects.requireNonNull;
27

28
/**
29
 * @author Andres Almiray
30
 * @since 0.3.0
31
 */
32
public class ProjectUploader {
33
    private final JReleaserContext context;
34
    private final Uploader<?> uploader;
35

36
    private ProjectUploader(JReleaserContext context,
UNCOV
37
                            Uploader<?> uploader) {
×
UNCOV
38
        this.context = context;
×
UNCOV
39
        this.uploader = uploader;
×
UNCOV
40
    }
×
41

42
    public Uploader<?> getUploader() {
43
        return uploader;
×
44
    }
45

46
    public boolean upload() throws UploadException {
UNCOV
47
        if (!uploader.isEnabled()) {
×
48
            context.getLogger().debug(RB.$("uploaders.skip.upload"), uploader.getName());
×
49
            return false;
×
50
        }
51

UNCOV
52
        ArtifactUploader<?, ?> artifactUploader = ArtifactUploaders.findUploader(context, uploader);
×
53

UNCOV
54
        context.getLogger().info(RB.$("uploaders.upload.to"), uploader.getName());
×
55

UNCOV
56
        artifactUploader.upload(uploader.getName());
×
UNCOV
57
        return true;
×
58
    }
59

60
    public static ProjectUploaderBuilder builder() {
UNCOV
61
        return new ProjectUploaderBuilder();
×
62
    }
63

UNCOV
64
    public static class ProjectUploaderBuilder {
×
65
        private JReleaserContext context;
66
        private Uploader<?> uploader;
67

68
        public ProjectUploaderBuilder context(JReleaserContext context) {
UNCOV
69
            this.context = requireNonNull(context, "'context' must not be null");
×
UNCOV
70
            return this;
×
71
        }
72

73
        public ProjectUploaderBuilder uploader(Uploader<?> uploader) {
UNCOV
74
            this.uploader = requireNonNull(uploader, "'uploader' must not be null");
×
UNCOV
75
            return this;
×
76
        }
77

78
        public ProjectUploader build() {
UNCOV
79
            requireNonNull(context, "'context' must not be null");
×
UNCOV
80
            requireNonNull(uploader, "'uploader' must not be null");
×
UNCOV
81
            return new ProjectUploader(context, uploader);
×
82
        }
83
    }
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc