Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.169
Language: C# Updated: 2026-10-17
Command

Send-GitHubRelease

Module PSPublishModule
Inputs
None

Creates a new release for the given GitHub repository and optionally uploads assets.

Syntax

Send-GitHubRelease [-AssetFilePaths <String[]>] [-Commitish <String>] [-GenerateReleaseNotes] -GitHubAccessToken <String> -GitHubRepositoryName <String> -GitHubUsername <String> [-IsDraft <Boolean>] [-IsPreRelease <Boolean>] [-ReleaseName <String>] [-ReleaseNotes <String>] [-ReuseExistingReleaseOnConflict <Boolean>] -TagName <String> [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

This cmdlet uses the GitHub REST API to create a release and upload assets. It is a lower-level building block used by higher-level helpers (such as Publish-GitHubReleaseAsset) and can also be used directly in CI pipelines.

Provide the token via an environment variable to avoid leaking secrets into logs or history.

Examples

Authored help example

Create a release and upload a ZIP asset

Send-GitHubRelease -GitHubUsername 'EvotecIT' -GitHubRepositoryName 'MyProject' -GitHubAccessToken $env:GITHUB_TOKEN -TagName 'v1.2.3' -ReleaseNotes 'Bug fixes' -AssetFilePaths 'C:\Artifacts\MyProject.zip'

Creates the release and uploads the specified asset file.

Create a prerelease as a draft

Send-GitHubRelease -GitHubUsername 'EvotecIT' -GitHubRepositoryName 'MyProject' -GitHubAccessToken $env:GITHUB_TOKEN -TagName 'v1.2.3-preview.1' -IsDraft $true -IsPreRelease $true

Creates a draft prerelease that can be reviewed before publishing.

Parameters

-AssetFilePaths String[] optional
The full paths of the files to include as release assets.
-Commitish String optional
Commitish value that determines where the Git tag is created from.
-GenerateReleaseNotes SwitchParameter optional
When set, asks GitHub to generate release notes automatically (cannot be used with ReleaseNotes).
-GitHubAccessToken String required
GitHub personal access token used for authentication.
-GitHubRepositoryName String required
GitHub repository name.
-GitHubUsername String required
GitHub username owning the repository.
-IsDraft Boolean optional
True to create a draft (unpublished) release.
-IsPreRelease Boolean optional
True to identify the release as a prerelease.
-ReleaseName String optional
The name of the release. If omitted, TagName is used.
-ReleaseNotes String optional
The text describing the contents of the release.
-ReuseExistingReleaseOnConflict Boolean optional
When true, a 422 tag conflict deliberately reuses the existing release. The default is false so normal publishing cannot mutate an older release.
-TagName String required
The tag name used for the release.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.