Release
This resource allows you to create and manage a release in a specific GitHub repository.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const repo = new github.Repository("repo", {
name: "repo",
description: "GitHub repo managed by Terraform",
"private": false,
});
const example = new github.Release("example", {
repository: repo.name,
tagName: "v1.0.0",
});
import pulumi
import pulumi_github as github
repo = github.Repository("repo",
name="repo",
description="GitHub repo managed by Terraform",
private=False)
example = github.Release("example",
repository=repo.name,
tag_name="v1.0.0")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var repo = new Github.Repository("repo", new()
{
Name = "repo",
Description = "GitHub repo managed by Terraform",
Private = false,
});
var example = new Github.Release("example", new()
{
Repository = repo.Name,
TagName = "v1.0.0",
});
});
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
repo, err := github.NewRepository(ctx, "repo", &github.RepositoryArgs{
Name: pulumi.String("repo"),
Description: pulumi.String("GitHub repo managed by Terraform"),
Private: pulumi.Bool(false),
})
if err != nil {
return err
}
_, err = github.NewRelease(ctx, "example", &github.ReleaseArgs{
Repository: repo.Name,
TagName: pulumi.String("v1.0.0"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.Release;
import com.pulumi.github.ReleaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var repo = new Repository("repo", RepositoryArgs.builder()
.name("repo")
.description("GitHub repo managed by Terraform")
.private_(false)
.build());
var example = new Release("example", ReleaseArgs.builder()
.repository(repo.name())
.tagName("v1.0.0")
.build());
}
}
resources:
repo:
type: github:Repository
properties:
name: repo
description: GitHub repo managed by Terraform
private: false
example:
type: github:Release
properties:
repository: ${repo.name}
tagName: v1.0.0
On Non-Default Branch
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
const example = new github.Repository("example", {
name: "repo",
autoInit: true,
});
const exampleBranch = new github.Branch("example", {
repository: example.name,
branch: "branch_name",
sourceBranch: example.defaultBranch,
});
const exampleRelease = new github.Release("example", {
repository: example.name,
tagName: "v1.0.0",
targetCommitish: exampleBranch.branch,
draft: false,
prerelease: false,
});
import pulumi
import pulumi_github as github
example = github.Repository("example",
name="repo",
auto_init=True)
example_branch = github.Branch("example",
repository=example.name,
branch="branch_name",
source_branch=example.default_branch)
example_release = github.Release("example",
repository=example.name,
tag_name="v1.0.0",
target_commitish=example_branch.branch,
draft=False,
prerelease=False)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
var example = new Github.Repository("example", new()
{
Name = "repo",
AutoInit = true,
});
var exampleBranch = new Github.Branch("example", new()
{
Repository = example.Name,
BranchName = "branch_name",
SourceBranch = example.DefaultBranch,
});
var exampleRelease = new Github.Release("example", new()
{
Repository = example.Name,
TagName = "v1.0.0",
TargetCommitish = exampleBranch.BranchName,
Draft = false,
Prerelease = false,
});
});
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := github.NewRepository(ctx, "example", &github.RepositoryArgs{
Name: pulumi.String("repo"),
AutoInit: pulumi.Bool(true),
})
if err != nil {
return err
}
exampleBranch, err := github.NewBranch(ctx, "example", &github.BranchArgs{
Repository: example.Name,
Branch: pulumi.String("branch_name"),
SourceBranch: example.DefaultBranch,
})
if err != nil {
return err
}
_, err = github.NewRelease(ctx, "example", &github.ReleaseArgs{
Repository: example.Name,
TagName: pulumi.String("v1.0.0"),
TargetCommitish: exampleBranch.Branch,
Draft: pulumi.Bool(false),
Prerelease: pulumi.Bool(false),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.Repository;
import com.pulumi.github.RepositoryArgs;
import com.pulumi.github.Branch;
import com.pulumi.github.BranchArgs;
import com.pulumi.github.Release;
import com.pulumi.github.ReleaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Repository("example", RepositoryArgs.builder()
.name("repo")
.autoInit(true)
.build());
var exampleBranch = new Branch("exampleBranch", BranchArgs.builder()
.repository(example.name())
.branch("branch_name")
.sourceBranch(example.defaultBranch())
.build());
var exampleRelease = new Release("exampleRelease", ReleaseArgs.builder()
.repository(example.name())
.tagName("v1.0.0")
.targetCommitish(exampleBranch.branch())
.draft(false)
.prerelease(false)
.build());
}
}
resources:
example:
type: github:Repository
properties:
name: repo
autoInit: true
exampleBranch:
type: github:Branch
name: example
properties:
repository: ${example.name}
branch: branch_name
sourceBranch: ${example.defaultBranch}
exampleRelease:
type: github:Release
name: example
properties:
repository: ${example.name}
tagName: v1.0.0
targetCommitish: ${exampleBranch.branch}
draft: false
prerelease: false
Import
This resource can be imported using the name
of the repository, combined with the id
of the release, and a :
character for separating components, e.g.
$ pulumi import github:index/release:Release example repo:12345678
Properties
If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see Managing categories for discussions in your repository.
Set to true
to automatically generate the name and body for this release. If name
is specified, the specified name
will be used; otherwise, a name will be automatically generated. If body
is specified, the body
will be pre-pended to the automatically generated notes.
Set to false
to identify the release as a full release.
This is the date when the release was published. This will be empty if the release is a draft.
The name of the repository.
URL that can be provided to API calls to fetch the release TAR archive.
The branch name or commit SHA the tag is created from. Defaults to the default branch of the repository.
URL that can be provided to API calls to fetch the release ZIP archive.