cimodules

package module
v4.4.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

README

dagger-ci-modules

modules

goreleaser

a module providing goreleaser. https://github.com/goreleaser/goreleaser

import (
    "dagger.io/dagger"
    "github.com/tubenhirn/dagger-ci-modules/v4"
)

// a context
ctx := context.Background()

// initialize Dagger client
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout))
if err != nil {
    panic(err)
}

defer client.Close()

dir, _ := os.Getwd()

options := cimodules.GoReleaserOpts{
    Source:     dir,
    Snapshot:   true,
    RemoveDist: true,
    Env: map[string]string{
        "APP_VERSION": string(version),
    },
}

cimodules.Release(ctx, *client, options)
semantic-release

a module providing semantic-release. https://github.com/semantic-release/github

import (
    "dagger.io/dagger"
    "github.com/tubenhirn/dagger-ci-modules/v4"
)

// a context
ctx := context.Background()

// initialize Dagger client
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout))
if err != nil {
    panic(err)
}

defer client.Close()

var secrets = make(map[string]dagger.SecretID)
githubTokenId, err = client.Host().EnvVariable("GITHUB_ACCESS_TOKEN").Secret().ID(ctx)
if err != nil {
    panic(err)
}
secrets["GITHUB_TOKEN"] = githubTokenId

dir, _ := os.Getwd()

options := cimodules.SemanticOpts{
    Source:   dir,
    Platform: "github",
    Env:      map[string]string{},
    Secret:   secrets,
}

if err := cimodules.Semanticrelease(ctx, *client, options); err != nil {
    fmt.Println(err)
}
renovate

a module providing renovate. https://github.com/renovatebot/renovate

import (
    "dagger.io/dagger"
    "github.com/tubenhirn/dagger-ci-modules/v4"
)

// a context
ctx := context.Background()

// initialize Dagger client
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout))
if err != nil {
    panic(err)
}

defer client.Close()

renovateTokenId, err = client.Host().EnvVariable("GITHUB_ACCESS_TOKEN").Secret().ID(ctx)
if err != nil {
    panic(err)
}

options := cimodules.RenovateOpts{
    Platform: "github",
    Autodiscover: false,
    AutodiscoverFilter: "",
    Repositories: "tubenhirn/dagger-ci-modules",
    Env: map[string]string{},
    Secret: map[string]dagger.SecretID{
        "RENOVATE_TOKEN": renovateTokenId,
        "GITHUB_COM_TOKEN":   renovateTokenId,
    },
    LogLevel: "debug",
}

cimodules.Renovate(ctx, *client, options)

create a new release

use the included Makefile to run the release job.

make release

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Release

func Release(ctx context.Context, client dagger.Client, opts GoReleaserOpts) error

func Renovate

func Renovate(ctx context.Context, client dagger.Client, opts RenovateOpts) error

func Semanticrelease

func Semanticrelease(ctx context.Context, client dagger.Client, opts SemanticOpts) error

Types

type GoReleaserOpts

type GoReleaserOpts struct {
	Source     string
	DryRun     bool `default:"false"`
	Snapshot   bool `default:"false"`
	RemoveDist bool `default:"false"`
	Env        map[string]string
	Secret     map[string]dagger.SecretID
}

type RenovateOpts

type RenovateOpts struct {
	Platform           string
	Autodiscover       bool
	AutodiscoverFilter string
	Repositories       string
	Env                map[string]string
	Secret             map[string]dagger.SecretID
	LogLevel           string
}

type SemanticOpts

type SemanticOpts struct {
	Source   string
	Platform string
	Env      map[string]string
	Secret   map[string]dagger.SecretID
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL