Skip to content

Commit ded00ca

Browse files
author
Github Actions
committed
Update GitHub Actions workflow and documentation to enhance build configuration. Changed AssetPatterns to support multiple file types and updated README to reflect new parameters in Get-BuildConfiguration, improving clarity for users.
1 parent 7c5527b commit ded00ca

2 files changed

Lines changed: 52 additions & 30 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
-NuGetApiKey "${{ secrets.NUGET_KEY }}" `
7272
-ExpectedOwner "ktsu-dev" `
7373
-ChangelogFile "CHANGELOG.md" `
74-
-AssetPatterns "*.nupkg"
74+
-AssetPatterns @("staging/*.nupkg", "staging/*.zip")
7575
7676
if (-not $buildConfig.Success) {
7777
throw $buildConfig.Error

scripts/README.md

Lines changed: 51 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,27 @@ A comprehensive PowerShell module for automating the build, test, package, and r
2626
The main entry point is `Invoke-CIPipeline`, which handles the complete build, test, package, and release process:
2727

2828
```powershell
29-
$result = Invoke-CIPipeline `
29+
# First, get the build configuration
30+
$buildConfig = Get-BuildConfiguration `
31+
-ServerUrl "https://github.com" `
3032
-GitRef "refs/heads/main" `
3133
-GitSha "abc123" `
32-
-WorkspacePath "." `
33-
-ServerUrl "https://github.com" `
34-
-Owner "myorg" `
35-
-Repository "myrepo" `
34+
-GitHubOwner "myorg" `
35+
-GitHubRepo "myrepo" `
3636
-GithubToken $env:GITHUB_TOKEN `
3737
-NuGetApiKey $env:NUGET_API_KEY `
38-
-Configuration "Release"
38+
-WorkspacePath "." `
39+
-ExpectedOwner "myorg" `
40+
-ChangelogFile "CHANGELOG.md" `
41+
-AssetPatterns @("staging/*.nupkg", "staging/*.zip")
42+
43+
# Then run the pipeline
44+
$result = Invoke-CIPipeline -BuildConfiguration $buildConfig
3945
4046
if ($result.Success) {
4147
Write-Host "Pipeline completed successfully!"
42-
if ($result.Data.ShouldRelease) {
43-
Write-Host "Released version: $($result.Data.Version)"
44-
}
48+
Write-Host "Version: $($result.Version)"
49+
Write-Host "Release Hash: $($result.ReleaseHash)"
4550
}
4651
```
4752

@@ -81,33 +86,50 @@ The module analyzes commit history to determine appropriate version increments:
8186
3. Considers the scope and impact of changes
8287
4. Maintains semantic versioning principles
8388

84-
## Environment Variables
89+
## Build Configuration
8590

86-
When running in GitHub Actions, the following environment variables are set:
91+
The `Get-BuildConfiguration` function returns a configuration object with the following key properties:
8792

88-
| Variable | Description |
93+
| Property | Description |
8994
|----------|-------------|
90-
| VERSION | The current version number |
91-
| LAST_VERSION | The previous version number |
92-
| LAST_VERSION_MAJOR | Previous major version number |
93-
| LAST_VERSION_MINOR | Previous minor version number |
94-
| LAST_VERSION_PATCH | Previous patch version number |
95-
| LAST_VERSION_PRERELEASE | Previous pre-release number |
96-
| IS_PRERELEASE | Whether current version is pre-release |
97-
| VERSION_INCREMENT | Type of version increment performed |
98-
| FIRST_COMMIT | First commit in analyzed range |
99-
| LAST_COMMIT | Last commit in analyzed range |
100-
| RELEASE_HASH | Hash of the metadata commit |
95+
| IsOfficial | Whether this is an official repository build |
96+
| IsMain | Whether building from main branch |
97+
| IsTagged | Whether the current commit is tagged |
98+
| ShouldRelease | Whether a release should be created |
99+
| UseDotnetScript | Whether .NET script files are present |
100+
| OutputPath | Path for build outputs |
101+
| StagingPath | Path for staging artifacts |
102+
| PackagePattern | Pattern for NuGet packages |
103+
| SymbolsPattern | Pattern for symbol packages |
104+
| ApplicationPattern | Pattern for application archives |
105+
| Version | Current version number |
106+
| ReleaseHash | Hash of the release commit |
101107

102108
## Advanced Usage
103109

104-
While `Invoke-CIPipeline` handles most use cases, these individual functions are available for advanced scenarios:
110+
The module provides several functions for advanced scenarios:
105111

106-
### Main Functions
107-
- `Update-ProjectMetadata`: Updates and commits metadata files
112+
### Build and Release Functions
113+
- `Initialize-BuildEnvironment`: Sets up the build environment
114+
- `Get-BuildConfiguration`: Creates the build configuration object
108115
- `Invoke-BuildWorkflow`: Runs the build and test process
109116
- `Invoke-ReleaseWorkflow`: Handles package creation and publishing
110117

118+
### Version Management Functions
119+
- `Get-GitTags`: Gets sorted list of version tags
120+
- `Get-VersionType`: Determines version increment type
121+
- `Get-VersionInfoFromGit`: Gets comprehensive version information
122+
- `New-Version`: Creates a new version file
123+
124+
### Package and Release Functions
125+
- `Invoke-DotNetRestore`: Restores NuGet packages
126+
- `Invoke-DotNetBuild`: Builds the solution
127+
- `Invoke-DotNetTest`: Runs unit tests with coverage
128+
- `Invoke-DotNetPack`: Creates NuGet packages
129+
- `Invoke-DotNetPublish`: Publishes applications
130+
- `Invoke-NuGetPublish`: Publishes packages to repositories
131+
- `New-GitHubRelease`: Creates GitHub release with assets
132+
111133
### Utility Functions
112134
- `Assert-LastExitCode`: Verifies command execution success
113135
- `Write-StepHeader`: Creates formatted step headers in logs
@@ -119,9 +141,9 @@ While `Invoke-CIPipeline` handles most use cases, these individual functions are
119141

120142
The module respects git's line ending settings when generating files:
121143

122-
- Uses git's `core.eol` setting if defined
123-
- Falls back to `core.autocrlf` setting
124-
- Defaults to OS-specific line endings if no git settings are found
144+
1. Uses git's `core.eol` setting if defined
145+
2. Falls back to `core.autocrlf` setting
146+
3. Defaults to OS-specific line endings if no git settings are found
125147

126148
## Contributing
127149

0 commit comments

Comments
 (0)