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

Publish-GitHubReleaseAsset

Module PSPublishModule
Inputs
None

Publishes a release asset to GitHub (creates a release and uploads a zip).

Syntax

Publish-GitHubReleaseAsset [-GenerateReleaseNotes] -GitHubAccessToken <String> -GitHubRepositoryName <String> -GitHubUsername <String> [-IncludeProjectNameInTag] [-IsPreRelease] -ProjectPath <String[]> [-ReleaseName <String>] [-TagName <String>] [-TagTemplate <String>] [-Version <String>] [-ZipPath <String>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Reads project metadata from *.csproj, resolves the release version (unless overridden), creates a GitHub release, and uploads the specified ZIP asset.

For private repositories, use a token with the minimal required scope and prefer providing it via an environment variable.

Examples

Authored help example

Create a release and upload the default ZIP asset

Publish-GitHubReleaseAsset -ProjectPath '.\MyProject\MyProject.csproj' -GitHubUsername 'EvotecIT' -GitHubRepositoryName 'MyProject' -GitHubAccessToken $env:GITHUB_TOKEN

Creates a GitHub release and uploads bin\Release\<Project>.<Version>.zip.

Publish a pre-release with a custom tag template

Publish-GitHubReleaseAsset -ProjectPath '.\MyProject\MyProject.csproj' -GitHubUsername 'EvotecIT' -GitHubRepositoryName 'MyProject' -GitHubAccessToken $env:GITHUB_TOKEN -IsPreRelease -TagTemplate '{Project}-v{Version}'

Useful when your repository uses a specific tag naming convention.

Parameters

-GenerateReleaseNotes SwitchParameter optional
When set, asks GitHub to generate release notes automatically.
-GitHubAccessToken String required
Personal access token used for authentication.
-GitHubRepositoryName String required
Name of the GitHub repository.
-GitHubUsername String required
GitHub account name owning the repository.
-IncludeProjectNameInTag SwitchParameter optional
When set, generates tag name as <Project>-v<Version>.
-IsPreRelease SwitchParameter optional
Publish the release as a pre-release.
-ProjectPath String[] required
Path to the project folder containing the *.csproj file.
-ReleaseName String optional
Optional release name override (defaults to TagName).
-TagName String optional
Optional tag name override.
-TagTemplate String optional
Optional tag template (supports {Project} and {Version}).
-Version String optional
Optional version override (otherwise read from VersionPrefix).
-ZipPath String optional
Optional zip path override (defaults to bin/Release/<Project>.<Version>.zip).

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.