Skip to content

Commit 2a33e8b

Browse files
committed
👷 [ci] Streamlines CI workflows and release process
- 👷 [ci] Removes scheduled triggers from multiple workflows. - This change centralizes scheduling to a dedicated system, improving maintainability and predictability. - Workflows affected: `git-sizer.yml`, `gitleaks.yml`, `osv-scanner.yml`, `repo-stats.yml`, `scorecards.yml`, and `security-devops.yml`. - 👷 [ci] Enhances the release workflow in `publish.yml` to use `git-cliff` for generating release notes. - 🛠️ Installs `git-cliff` in the workflow using PowerShell to download, extract, and add it to the PATH. 📦 - ✨ Implements a release notes generation step that uses a PowerShell script (`Generate-ReleaseNotes.ps1`) to create release notes based on whether the tag exists or not. 📝 - If no release notes are generated, a fallback is used. ⚠️ - 📝 Writes the generated release notes to a file for use in the GitHub Release. 📤 - ♻️ Updates the `ncipollo/release-action` to include the generated release notes and package artifacts. 📦 - ✅ Adds `allowUpdates: true` and `updateOnlyUnreleased: false` to the release action to allow updating existing releases. 🔄 - ⏪ [ci] Removes the original GitHub Release creation step, as it is replaced by the new implementation. 🗑️ Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>
1 parent e5d4669 commit 2a33e8b

10 files changed

Lines changed: 225 additions & 171 deletions

File tree

.github/workflows/git-sizer.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Scheduled repo analysis with git-sizer
22

33
on:
4-
schedule:
5-
- cron: "44 2 * * 0" # Runs on Sundays at 2:44 AM UTC; https://crontab.guru/#44_2_*_*_0
64
push:
75
pull_request:
86
workflow_dispatch:

.github/workflows/gitleaks.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
pull_request:
55
push:
66
workflow_dispatch:
7-
schedule:
8-
- cron: "12 4 * * *" # run once a day at 4:12 AM
97

108
permissions:
119
contents: read

.github/workflows/osv-scanner.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ on:
4141
branches: ["main"]
4242
merge_group:
4343
branches: ["main"]
44-
schedule:
45-
- cron: "39 12 * * 1"
4644
push:
4745
branches: ["main"]
4846

.github/workflows/publish.yml

Lines changed: 79 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,6 @@ jobs:
198198
}
199199
}
200200
201-
- name: Create GitHub Release
202-
if: ${{ github.event_name != 'workflow_dispatch' || env.CREATE_RELEASE_INPUT != 'false' }}
203-
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
204-
with:
205-
tag: v${{ steps.manifest.outputs.version }}
206-
name: Release v${{ steps.manifest.outputs.version }}
207-
draft: false
208-
prerelease: false
209-
generateReleaseNotes: true
210-
skipIfReleaseExists: true
211-
212201
- name: Package module
213202
id: package
214203
run: |
@@ -253,6 +242,85 @@ jobs:
253242
run: pwsh -NoProfile -File ./scripts/Update-NuGetPackageMetadata.ps1 -PackagePath '${{ steps.package.outputs.packagePath }}'
254243
shell: pwsh
255244

245+
- name: Install git-cliff
246+
if: ${{ github.event_name != 'workflow_dispatch' || env.CREATE_RELEASE_INPUT != 'false' }}
247+
run: |
248+
Write-Host "Installing git-cliff..."
249+
$downloadUrl = "https://github.com/orhun/git-cliff/releases/latest/download/git-cliff-x86_64-pc-windows-msvc.zip"
250+
$zipPath = Join-Path $env:RUNNER_TEMP "git-cliff.zip"
251+
$extractPath = Join-Path $env:RUNNER_TEMP "git-cliff"
252+
253+
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath
254+
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force
255+
256+
$exePath = Join-Path $extractPath "git-cliff.exe"
257+
if (-not (Test-Path $exePath)) {
258+
throw "git-cliff.exe not found after extraction"
259+
}
260+
261+
# Add to PATH for this session
262+
$env:PATH = "$extractPath;$env:PATH"
263+
"PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
264+
265+
Write-Host "git-cliff installed successfully"
266+
& $exePath --version
267+
shell: pwsh
268+
269+
- name: Generate release notes
270+
if: ${{ github.event_name != 'workflow_dispatch' || env.CREATE_RELEASE_INPUT != 'false' }}
271+
id: release-notes
272+
run: |
273+
$version = '${{ steps.manifest.outputs.version }}'
274+
Write-Host "Generating release notes for version $version"
275+
276+
# Check if the tag exists yet
277+
$tagExists = git tag -l "v$version"
278+
279+
if ($tagExists) {
280+
# Tag exists, generate notes for latest tag
281+
Write-Host "Tag v$version exists, generating notes for latest release"
282+
$notes = & pwsh -NoProfile -File ./scripts/Generate-ReleaseNotes.ps1 -Latest
283+
} else {
284+
# Tag doesn't exist yet, generate unreleased notes
285+
Write-Host "Tag v$version doesn't exist yet, generating unreleased notes"
286+
$notes = & pwsh -NoProfile -File ./scripts/Generate-ReleaseNotes.ps1 -Unreleased
287+
}
288+
289+
if ([string]::IsNullOrWhiteSpace($notes)) {
290+
Write-Warning "No release notes generated, using fallback"
291+
$notes = @"
292+
## Release v$version
293+
294+
See [CHANGELOG.md](https://github.com/Nick2bad4u/ps-color-scripts-enhanced/blob/main/CHANGELOG.md) for full details.
295+
"@
296+
}
297+
298+
# Write to file for GitHub Actions
299+
$notesFile = Join-Path $env:RUNNER_TEMP "release-notes.md"
300+
Set-Content -Path $notesFile -Value $notes -Encoding UTF8
301+
302+
Write-Host "Release notes preview:"
303+
Write-Host "------------------------"
304+
Write-Host $notes
305+
Write-Host "------------------------"
306+
307+
"notesFile=$notesFile" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
308+
shell: pwsh
309+
310+
- name: Create GitHub Release
311+
if: ${{ github.event_name != 'workflow_dispatch' || env.CREATE_RELEASE_INPUT != 'false' }}
312+
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
313+
with:
314+
tag: v${{ steps.manifest.outputs.version }}
315+
name: Release v${{ steps.manifest.outputs.version }}
316+
bodyFile: ${{ steps.release-notes.outputs.notesFile }}
317+
artifacts: ${{ steps.package.outputs.packagePath }}
318+
draft: false
319+
prerelease: false
320+
allowUpdates: true
321+
updateOnlyUnreleased: false
322+
skipIfReleaseExists: false
323+
256324
- name: Publish to PowerShell Gallery
257325
run: |
258326
$packagePath = '${{ steps.package.outputs.packagePath }}'

.github/workflows/repo-stats.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Metrics - Repository Stats
22

33
on:
44
workflow_dispatch:
5-
schedule:
6-
- cron: "53 4 1 * *" # Runs monthly at 4:53 AM (UTC)
75
push:
86
branches: [repo-stats]
97
pull_request:

.github/workflows/scorecards.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
branch_protection_rule:
1010
# To guarantee Maintained check is occasionally updated. See
1111
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12-
schedule:
13-
- cron: "20 7 * * 2"
1412
push:
1513
branches: ["main"]
1614

.github/workflows/security-devops.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
pull_request:
66
workflow_dispatch:
7-
schedule:
8-
- cron: "23 9 * * *" # Every day at 9:23 AM UTC
97

108
permissions:
119
security-events: write

ColorScripts-Enhanced/ColorScripts-Enhanced.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
RootModule = 'ColorScripts-Enhanced.psm1'
1212

1313
# Version number of this module.
14-
ModuleVersion = '2025.10.13.1447'
14+
ModuleVersion = '2025.10.13.1537'
1515

1616
# Supported PSEditions
1717
CompatiblePSEditions = @('Desktop', 'Core')
@@ -171,7 +171,7 @@ Full documentation: https://github.com/Nick2bad4u/ps-color-scripts-enhanced
171171

172172
# ReleaseNotes of this module
173173
ReleaseNotes = @'
174-
Version 2025.10.13.1447:
174+
Version 2025.10.13.1537:
175175
- Enhanced caching system with OS-wide cache in AppData
176176
- 6-19x performance improvement
177177
- Cache stored in centralized location

0 commit comments

Comments
 (0)