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

jreleaser / jreleaser / #477

04 Apr 2025 05:53PM UTC coverage: 35.124% (-5.1%) from 40.183%
#477

push

github

aalmiray
fix(deploy): Add missing Forgejo messages

Related to #1842

18210 of 51845 relevant lines covered (35.12%)

0.35 hits per line

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

0.0
/sdks/jreleaser-git-java-sdk/src/main/java/org/jreleaser/sdk/git/release/AbstractReleaser.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.sdk.git.release;
19

20
import org.jreleaser.bundle.RB;
21
import org.jreleaser.model.JReleaserException;
22
import org.jreleaser.model.internal.JReleaserContext;
23
import org.jreleaser.model.internal.release.BaseReleaser;
24
import org.jreleaser.model.spi.release.Asset;
25
import org.jreleaser.model.spi.release.ReleaseException;
26
import org.jreleaser.model.spi.release.Releaser;
27
import org.jreleaser.sdk.git.ChangelogProvider;
28

29
import java.io.IOException;
30
import java.util.Set;
31
import java.util.TreeSet;
32

33
/**
34
 * @author Andres Almiray
35
 * @since 0.7.0
36
 */
37
public abstract class AbstractReleaser<A extends org.jreleaser.model.api.release.Releaser> implements Releaser<A> {
38
    private static final long serialVersionUID = 362449254352903201L;
39

40
    protected final JReleaserContext context;
41
    protected final Set<Asset> assets = new TreeSet<>();
×
42

43
    protected AbstractReleaser(JReleaserContext context, Set<Asset> assets) {
×
44
        this.context = context;
×
45
        this.assets.addAll(assets);
×
46
    }
×
47

48
    @Override
49
    public final void release() throws ReleaseException {
50
        BaseReleaser<?, ?> service = context.getModel().getRelease().getReleaser();
×
51

52
        if (service.isSkipRelease()) {
×
53
            if (service.isSkipTag()) {
×
54
                context.getLogger().info(RB.$("releaser.tag.and.release.skipped"));
×
55
            } else {
56
                createTag();
×
57
            }
58
        } else {
59
            createRelease();
×
60
        }
61
    }
×
62

63
    @Override
64
    public String generateReleaseNotes() throws IOException {
65
        try {
66
            return ChangelogProvider.getChangelog(context).trim();
×
67
        } catch (IOException e) {
×
68
            throw new JReleaserException(RB.$("ERROR_unexpected_error_changelog"), e);
×
69
        }
70
    }
71

72
    protected void createTag() throws ReleaseException {
73
        ReleaseUtils.createTag(context);
×
74
    }
×
75

76
    protected abstract void createRelease() throws ReleaseException;
77
}
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