1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-05 00:59:04 +02:00

feat: add gitlab for releases (#1038)

* outlines gitlab client integration

* makes client parameter more explicit

* adds gitlab url to config

* changes releaseID to string to adapt to gitlab

* updates to latest gitlab client lib 0.18

* fixes copy paster in gitlab upload func

* fixes gitlab typo in config

* adds gitlab token to env and context

* release now uses the client factory method

* skips brew pipe if it is not a github release

* add github tokentype to publish tests

* skips scoop pipe if it is not a github release

* corrects brew skip msg

* adds gitlab token to main test

* adds gitlab to release docs

* validates config and errors accordingly

* adapt release pipe name to include gitlab

* fixes gitlab client after testing

* moves not-configured brew and scoop pipe checks as first check

* adds more debug to gitlab client

* adapts changelog generation for gitlab markdown

* adds debug log for gitlab changelog

* env needs to run before changelog pipe

* moves gitlab default download url to default pipe

* moves multiple releases check to from config to release pipe

* release differs now for github and gitlab

* adds debug gitlab release update msgs

* moves env pipe as second after before because it determines the token type other pipes depend on

* adaptes error check on gitlab release creation

* Revert "adaptes error check on gitlab release creation"

This reverts commit 032024571c.

* simplifies gitlab client logic. removes comments

* skips tls verification for gitlab client if specified in config

* updates the docs

* adds clarification that brew and scoop are not supported if it is a gitlab release

* fixes copy paster in release.md

* adds missing blob pipe in defaults and publish due to missing in merge

* updates comment in gitlab client
This commit is contained in:
Manuel Vogel
2019-06-29 16:02:40 +02:00
committed by Carlos Alexandro Becker
parent 0a8478bf19
commit eb7ba2a294
29 changed files with 692 additions and 493 deletions

View File

@ -5,6 +5,7 @@ import (
"net/http"
"net/url"
"os"
"strconv"
"github.com/apex/log"
"github.com/google/go-github/v25/github"
@ -100,11 +101,11 @@ func (c *githubClient) CreateFile(
return err
}
func (c *githubClient) CreateRelease(ctx *context.Context, body string) (int64, error) {
func (c *githubClient) CreateRelease(ctx *context.Context, body string) (string, error) {
var release *github.RepositoryRelease
title, err := tmpl.New(ctx).Apply(ctx.Config.Release.NameTemplate)
if err != nil {
return 0, err
return "", err
}
var data = &github.RepositoryRelease{
@ -141,20 +142,25 @@ func (c *githubClient) CreateRelease(ctx *context.Context, body string) (int64,
)
}
log.WithField("url", release.GetHTMLURL()).Info("release updated")
return release.GetID(), err
githubReleaseID := strconv.FormatInt(release.GetID(), 10)
return githubReleaseID, err
}
func (c *githubClient) Upload(
ctx *context.Context,
releaseID int64,
releaseID string,
name string,
file *os.File,
) error {
_, _, err := c.client.Repositories.UploadReleaseAsset(
githubReleaseID, err := strconv.ParseInt(releaseID, 10, 64)
if err != nil {
return err
}
_, _, err = c.client.Repositories.UploadReleaseAsset(
ctx,
ctx.Config.Release.GitHub.Owner,
ctx.Config.Release.GitHub.Name,
releaseID,
githubReleaseID,
&github.UploadOptions{
Name: name,
},