diff --git a/.github/README_template.md b/.github/DOCS_TEMPLATE/README_template.md similarity index 82% rename from .github/README_template.md rename to .github/DOCS_TEMPLATE/README_template.md index 5ae8269..392049c 100644 --- a/.github/README_template.md +++ b/.github/DOCS_TEMPLATE/README_template.md @@ -7,6 +7,14 @@ [![Downloads](https://img.shields.io/powershellgallery/dt/{MODULE_NAME}.svg)](https://www.powershellgallery.com/packages/{MODULE_NAME}) [![License](https://img.shields.io/github/license/{MODULE_PATH})](LICENSE) +## About + +{MODULE_NAME} is a PowerShell module that {BRIEF_MODULE_PURPOSE}. It aims to {MODULE_GOALS_OR_OBJECTIVES}. + +## Why {MODULE_NAME}? + +{MODULE_NAME} is designed to {BRIEF_MODULE_PURPOSE}. It simplifies {SPECIFIC_TASKS_OR_PROCESSES} by providing {KEY_BENEFITS_OR_FEATURES}. + ## 🚀 Getting Started ### Prerequisites @@ -36,8 +44,8 @@ Get-Command -Module {MODULE_NAME} Comprehensive documentation is available in the [`docs/`](docs/) directory: +- 🚀 **[Getting Started](docs/getting-started.md)** - Practical examples and usage scenarios - 📘 **[Module Help](docs/)** - Help files for cmdlets and functions -- 🚀 **[Examples](docs/examples/)** - Practical examples and usage scenarios ## 🤝 Contributing diff --git a/.github/DOCS_TEMPLATE/getting-started_template.md b/.github/DOCS_TEMPLATE/getting-started_template.md new file mode 100644 index 0000000..40ff822 --- /dev/null +++ b/.github/DOCS_TEMPLATE/getting-started_template.md @@ -0,0 +1,23 @@ +# {MODULE_NAME} Usage Guide + +## Overview + +{MODULE_DESCRIPTION} + +## Key Features + +## Core Functions + +## Complete Workflow Example + +## Pipeline Examples + +## Error Handling + +## Best Practices + +## Security Considerations + +## Troubleshooting + +## Resources diff --git a/.github/actions/ps-build/action.yml b/.github/actions/ps-build/action.yml index d897f87..d0a8c96 100644 --- a/.github/actions/ps-build/action.yml +++ b/.github/actions/ps-build/action.yml @@ -95,5 +95,6 @@ runs: fi git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" + git config push.autoSetupRemote true git commit -m "Update PowerShell help for release v${{ steps.gitversion.outputs.majorMinorPatch }}" - git push origin HEAD:main + git push diff --git a/.github/actions/ps-release/action.yml b/.github/actions/ps-release/action.yml index 991f117..2c9d3b0 100644 --- a/.github/actions/ps-release/action.yml +++ b/.github/actions/ps-release/action.yml @@ -10,6 +10,10 @@ inputs: publish-psgallery: description: Publish to PowerShell Gallery required: true +secrets: + PSGALLERY_API_KEY: + description: API Key for PowerShell Gallery + required: false runs: using: composite steps: @@ -20,12 +24,16 @@ runs: GITHUB_TOKEN: ${{ github.token }} run: | git fetch --tags - $previousTag = (git tag --sort=-v:refname)[0] + $tags = @(git tag --sort=-v:refname) + $previousTag = if ($tags.Count -gt 0) { $tags[0] } else { $null } $uri = "https://api.github.com/repos/${{ github.repository }}/releases/generate-notes" $body = @{ tag_name = "v${{ inputs.release-version }}" target_commitish = "main" - previous_tag_name = $previousTag + } + # Only include previous_tag_name if a previous tag exists + if ($previousTag) { + $body['previous_tag_name'] = $previousTag } $requestParams = @{ Method = 'Post' @@ -54,8 +62,6 @@ runs: - name: Publish build package to PSGallery if: ${{ inputs.publish-psgallery == 'true' && env.PSGALLERY_API_KEY != '' }} shell: pwsh - env: - PSGALLERY_API_KEY: ${{ env.PSGALLERY_API_KEY }} run: | Set-StrictMode -Version Latest [void] (Import-Module InvokeBuild) diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 4713668..c9ebc4c 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -116,7 +116,7 @@ jobs: MODULE_DESCRIPTION="${{ needs.get_repo_state.outputs.description }}" MODULE_PATH=${{ github.repository }} rm README.md - mv .github/README_template.md README.md + mv .github/DOCS_TEMPLATE/README_template.md README.md sed -i "s|PSScriptModule|$MODULE_NAME|g" README.md sed -i "s|{MODULE_NAME}|$MODULE_NAME|g" README.md sed -i "s|{MODULE_DESCRIPTION}|$MODULE_DESCRIPTION|g" README.md @@ -169,8 +169,12 @@ jobs: - name: Update getting-started.md run: | + rm docs/getting-started.md + mv .github/DOCS_TEMPLATE/getting-started_template.md docs/getting-started.md MODULE_NAME=${{ github.event.repository.name }} - sed -i "s/PSScriptModule/$MODULE_NAME/g" docs/getting-started.md + MODULE_DESCRIPTION="${{ needs.get_repo_state.outputs.description }}" + sed -i "s/{MODULE_NAME}/$MODULE_NAME/g" docs/getting-started.md + sed -i "s/{MODULE_DESCRIPTION}/$MODULE_DESCRIPTION/g" docs/getting-started.md - name: Update integration test file run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 521de70..4700407 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,18 @@ on: - '*.psd1' jobs: + changes: + name: Label Changes + runs-on: [ubuntu-latest] + if: github.event_name == 'pull_request' + permissions: + contents: read + pull-requests: write + steps: + - name: Labeler + id: labeler + uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b #v6.0.1 + dependencies: name: Dependencies runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d7ce1a..b633cce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,27 +25,28 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - env: - PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }} steps: - name: Checkout repository uses: actions/checkout@v6 with: repository: ${{ github.repository }} fetch-depth: 0 + - name: Resolve dependencies id: resolve uses: ./.github/actions/ps-resolve-dependencies + - name: Build Module id: build uses: ./.github/actions/ps-build with: release-type: ${{ inputs['release-type'] }} module-list: ${{ steps.resolve.outputs.module-list }} + - name: Release Module uses: ./.github/actions/ps-release + env: + PSGALLERY_API_KEY: ${{ secrets.NUGETAPIKEY_PSGALLERY }} with: - release-type: ${{ inputs['release-type'] }} release-version: ${{ steps.build.outputs.release-version }} - module-list: ${{ steps.resolve.outputs.module-list }} publish-psgallery: ${{ inputs.publish-psgallery }} diff --git a/tests/Integration/Module.Integration.Tests.ps1 b/tests/Integration/Module.Integration.Tests.ps1 index ca2c90b..40de9a0 100644 --- a/tests/Integration/Module.Integration.Tests.ps1 +++ b/tests/Integration/Module.Integration.Tests.ps1 @@ -61,7 +61,7 @@ Describe 'PSScriptModule Integration Tests' -Tag 'Integration' { } It 'Public function files' { - $publicFunctionFiles | Should -HaveCount 1 -Because 'The template ships with a single public function' + $publicFunctionFiles.Count | Should -BeGreaterThan 0 } It 'Should discover public functions from src/Public' {