diff --git a/.github/workflows/ci-master-pr.yml b/.github/workflows/ci-master-pr.yml index 3b6cf68..3542e9a 100644 --- a/.github/workflows/ci-master-pr.yml +++ b/.github/workflows/ci-master-pr.yml @@ -11,45 +11,10 @@ on: - master jobs: - test-powershell-5-1-windows-2016: - runs-on: windows-2016 - steps: - - uses: actions/checkout@v2 - - name: Display system info (windows) - run: | - Set-StrictMode -Version Latest; $ErrorActionPreference = 'Stop' - hostname - whoami - systeminfo - Get-PSDrive - Get-Location - # pwsh version - $PSVersionTable - # Windows Powershell version? - powershell -Command '$PSVersionTable' - - name: Powershell version - run: | - powershell -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' - - name: Test - run: | - powershell -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' - test-powershell-5-1-windows-2019: runs-on: windows-2019 steps: - - uses: actions/checkout@v2 - - name: Display system info (windows) - run: | - Set-StrictMode -Version Latest; $ErrorActionPreference = 'Stop' - hostname - whoami - systeminfo - Get-PSDrive - Get-Location - # pwsh version - $PSVersionTable - # Windows Powershell version? - powershell -Command '$PSVersionTable' + - uses: actions/checkout@v3 - name: Powershell version run: | powershell -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' @@ -57,57 +22,16 @@ jobs: run: | powershell -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' - # ubuntu-16-04: - # runs-on: ubuntu-16.04 - # steps: - # - uses: actions/checkout@v2 - # - name: Display system info (linux) - # run: | - # set -e - # hostname - # whoami - # cat /etc/*release - # lscpu - # free - # df -h - # pwd - # docker info - # docker version - - # macos-10-15: - # runs-on: macos-10.15 - # steps: - # - uses: actions/checkout@v2 - # - name: Display system info (macos) - # run: | - # set -e - # hostname - # whoami - # df -h - # pwd - # # docker info - # # docker version - ########## # Docker # ########## + # Get powershell tags: https://mcr.microsoft.com/v2/powershell/tags/list test-powershell-6-0: - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest container: - # image: theohbrothers/docker-powershell:6.0.2-ubuntu-16.04-git image: mcr.microsoft.com/powershell:6.0.2-ubuntu-16.04 steps: - - uses: actions/checkout@v2 - - name: Display system info (linux) - run: | - set -e - hostname - whoami - cat /etc/*release - lscpu - free - df -h - pwd + - uses: actions/checkout@v3 - name: Powershell version run: | pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' @@ -116,23 +40,11 @@ jobs: pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' test-powershell-6-1: - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest container: - # image: theohbrothers/docker-powershell:6.1.3-alpine-3.8-git - # image: mcr.microsoft.com/powershell:6.1.3-alpine-3.8 image: mcr.microsoft.com/powershell:6.1.3-ubuntu-18.04 steps: - - uses: actions/checkout@v2 - - name: Display system info (linux) - run: | - set -e - hostname - whoami - cat /etc/*release - # lscpu - free - df -h - pwd + - uses: actions/checkout@v3 - name: Powershell version run: | pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' @@ -141,23 +53,11 @@ jobs: pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' test-powershell-6-2: - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest container: - # image: theohbrothers/docker-powershell:6.2.4-alpine-3.8-git - # image: mcr.microsoft.com/powershell:6.2.4-alpine-3.8 image: mcr.microsoft.com/powershell:6.2.4-ubuntu-18.04 steps: - - uses: actions/checkout@v2 - - name: Display system info (linux) - run: | - set -e - hostname - whoami - cat /etc/*release - # lscpu - free - df -h - pwd + - uses: actions/checkout@v3 - name: Powershell version run: | pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' @@ -166,23 +66,11 @@ jobs: pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' test-powershell-7-0: - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest container: - # image: theohbrothers/docker-powershell:7.0.3-alpine-3.9-20200928 - # image: mcr.microsoft.com/powershell:7.0.3-alpine-3.9 image: mcr.microsoft.com/powershell:7.0.3-ubuntu-18.04 steps: - - uses: actions/checkout@v2 - - name: Display system info (linux) - run: | - set -e - hostname - whoami - cat /etc/*release - # lscpu - free - df -h - pwd + - uses: actions/checkout@v3 - name: Powershell version run: | pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' @@ -191,23 +79,11 @@ jobs: pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' test-powershell-7-1: - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest container: - # image: theohbrothers/docker-powershell:7.1.3-alpine-3.11-20210316-git - # image: mcr.microsoft.com/powershell:7.1.3-alpine-3.11-20210316 image: mcr.microsoft.com/powershell:7.1.3-ubuntu-18.04 steps: - - uses: actions/checkout@v2 - - name: Display system info (linux) - run: | - set -e - hostname - whoami - cat /etc/*release - # lscpu - free - df -h - pwd + - uses: actions/checkout@v3 - name: Powershell version run: | pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' @@ -216,23 +92,11 @@ jobs: pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' test-powershell-7-2: - runs-on: ubuntu-16.04 + runs-on: ubuntu-latest container: - # image: theohbrothers/docker-powershell:7.2.0-preview.4-alpine-3.11-20210316-git - # image: mcr.microsoft.com/powershell:7.2.0-preview.4-alpine-3.11-20210316 - image: mcr.microsoft.com/powershell:7.2.0-preview.4-ubuntu-18.04 + image: mcr.microsoft.com/powershell:7.2.2-ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - name: Display system info (linux) - run: | - set -e - hostname - whoami - cat /etc/*release - # lscpu - free - df -h - pwd + - uses: actions/checkout@v3 - name: Powershell version run: | pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' @@ -241,54 +105,95 @@ jobs: pwsh -NoLogo -NonInteractive -NoProfile -Command './test/test.ps1' update-draft-release: - needs: [test-powershell-5-1-windows-2016, test-powershell-5-1-windows-2019, test-powershell-6-0, test-powershell-6-1, test-powershell-6-1, test-powershell-7-0, test-powershell-7-1, test-powershell-7-2] + needs: + - test-powershell-5-1-windows-2019 + - test-powershell-6-0 + - test-powershell-6-1 + - test-powershell-6-2 + - test-powershell-7-0 + - test-powershell-7-1 + - test-powershell-7-2 + - test-publish-to-psgallery if: github.ref == 'refs/heads/master' runs-on: ubuntu-latest steps: # Drafts your next Release notes as Pull Requests are merged into "master" - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter.yml + publish: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + test-publish-to-psgallery: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Powershell version + run: | + pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' + - name: Publish (dry run) + shell: pwsh + env: + MODULE_VERSION: '999.0.0' + NUGET_API_KEY: 'xxx' + run: | + $ErrorActionPreference = 'Stop' + + # Generate the new module manifest + $moduleManifest = ./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Build.ps1 + + # Publish the module + ./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath $moduleManifest -Repository PSGallery -DryRun + publish-to-psgallery: - needs: [test-powershell-5-1-windows-2016, test-powershell-5-1-windows-2019, test-powershell-6-0, test-powershell-6-1, test-powershell-6-1, test-powershell-7-0, test-powershell-7-1, test-powershell-7-2] + needs: + - test-powershell-5-1-windows-2019 + - test-powershell-6-0 + - test-powershell-6-1 + - test-powershell-6-2 + - test-powershell-7-0 + - test-powershell-7-1 + - test-powershell-7-2 + - test-publish-to-psgallery if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true - name: Powershell version run: | pwsh -NoLogo -NonInteractive -NoProfile -Command '$PSVersionTable' - name: Publish + shell: pwsh env: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} run: | - set -e - - # Get 'ref-name' from 'refs/heads/ref-name' - REF=$( echo "${GITHUB_REF}" | rev | cut -d '/' -f 1 | rev ) + $ErrorActionPreference = 'Stop' # Strip of 'v' prefix from tag - MODULE_VERSION=$( echo "${REF}" | sed 's/^v*//' ) + $env:MODULE_VERSION = $env:GITHUB_REF_NAME -replace '^v', '' # Generate the new module manifest - MODULE_NAME=$(basename $(pwd)) - MODULE_VERSION=${MODULE_VERSION} pwsh -Command "build/PSModulePublisher/src/module/Generate-ModuleManifest.ps1 -DefinitionFile build/definitions/modulemanifest/definition.ps1 -Path src/$MODULE_NAME/$MODULE_NAME.psd1" + $moduleManifest = ./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Build.ps1 # Publish the module - NUGET_API_KEY=${NUGET_API_KEY} MODULE_VERSION=${MODULE_VERSION} pwsh -Command "build/PSModulePublisher/src/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery" + ./build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath $moduleManifest -Repository PSGallery publish-draft-release: - needs: [test-powershell-5-1-windows-2016, test-powershell-5-1-windows-2019, test-powershell-6-0, test-powershell-6-1, test-powershell-6-1, test-powershell-7-0, test-powershell-7-1, test-powershell-7-2, publish-to-psgallery] + needs: [publish-to-psgallery] if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - - id: release-drafter - uses: release-drafter/release-drafter@v5 - with: - # config-name: release-drafter.yaml - publish: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter.yml + publish: true + name: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3' + tag: ${{ github.ref_name }} # E.g. 'master' or 'v1.2.3' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d02091d..82c2e27 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,13 +7,13 @@ "id": "NUGET_API_KEY", "description": "NUGET_API_KEY?", "type": "promptString", - "default": "", + "default": "xxx", }, { "id": "MODULE_VERSION", "description": "MODULE_VERSION?", "type": "promptString", - "default": "", + "default": "0.0.0", }, ], "tasks": [ @@ -21,48 +21,36 @@ "label": "Test (pwsh)", "type": "shell", "command": "pwsh -Command test/test.ps1", - "group": { - "isDefault": true, - "kind": "test" - } + "group": "build" }, { "label": "Test (powershell)", "type": "shell", "command": "powershell -Command test/test.ps1", - "group": { - "isDefault": true, - "kind": "test" - } + "group": "build" }, { "label": "Build: Generate module manifest", "type": "shell", - "command": "MODULE_NAME=$(basename $(pwd)); MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/module/Generate-ModuleManifest.ps1 -DefinitionFile build/definitions/modulemanifest/definition.ps1 -Path src/$MODULE_NAME/$MODULE_NAME.psd1\"", - "group": { - "isDefault": true, - "kind": "build" - } - }, - { - "label": "Build: Test module manifest", - "type": "shell", - "command": "MODULE_NAME=$(basename $(pwd)); MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/module/Test-ModuleManifest.ps1 -Path src/$MODULE_NAME/$MODULE_NAME.psd1\"", - "group": { - "isDefault": true, - "kind": "build" - } + "command": "MODULE_VERSION=${input:MODULE_VERSION} pwsh build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Build.ps1", + "group": "build" }, { "label": "Publish module (dry run)", + "dependsOn":[ + "Build: Generate module manifest" + ], "type": "shell", - "command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery -DryRun\"", + "command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery -DryRun", "group": "build" }, { "label": "Publish module", + "dependsOn":[ + "Build: Generate module manifest" + ], "type": "shell", - "command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh -Command \"build/PSModulePublisher/src/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery\"", + "command": "MODULE_NAME=$(basename $(pwd)); NUGET_API_KEY=${input:NUGET_API_KEY} MODULE_VERSION=${input:MODULE_VERSION} pwsh build/PSModulePublisher/src/PSModulePublisher/Public/Invoke-Publish.ps1 -ModuleManifestPath src/$MODULE_NAME/$MODULE_NAME.psd1 -Repository PSGallery", "group": "build" }, diff --git a/README.md b/README.md index 2241334..74f7a30 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Position-ExplorerWindow -[![github-actions](https://github.com/theohbrothers/Position-ExplorerWindow/workflows/ci-master-pr/badge.svg)](https://github.com/theohbrothers/Position-ExplorerWindow/actions) +[![github-actions](https://github.com/theohbrothers/Position-ExplorerWindow/actions/workflows/ci-master-pr.yml/badge.svg?branch=master)](https://github.com/theohbrothers/Position-ExplorerWindow/actions/workflows/ci-master-pr.yml) [![github-release](https://img.shields.io/github/v/release/theohbrothers/Position-ExplorerWindow?style=flat-square)](https://github.com/theohbrothers/Position-ExplorerWindow/releases/) [![powershell-gallery-release](https://img.shields.io/powershellgallery/v/Position-ExplorerWindow?logo=powershell&logoColor=white&label=PSGallery&labelColor=&style=flat-square)](https://www.powershellgallery.com/packages/Position-ExplorerWindow/) diff --git a/build/PSModulePublisher b/build/PSModulePublisher index 8eeb0c3..f981361 160000 --- a/build/PSModulePublisher +++ b/build/PSModulePublisher @@ -1 +1 @@ -Subproject commit 8eeb0c36e493eff597b8bba589eb8e487c6086f1 +Subproject commit f981361938ec2848057aade59308757c29d11d57 diff --git a/build/definitions/modulemanifest/definition.ps1 b/build/definitions/modulemanifest.ps1 similarity index 95% rename from build/definitions/modulemanifest/definition.ps1 rename to build/definitions/modulemanifest.ps1 index feb2779..95d4578 100644 --- a/build/definitions/modulemanifest/definition.ps1 +++ b/build/definitions/modulemanifest.ps1 @@ -23,7 +23,7 @@ # FormatsToProcess = @() # NestedModules = @() FunctionsToExport = @( - Get-ChildItem $PSScriptRoot/../../../src/Position-ExplorerWindow/public -Exclude *.Tests.ps1 | % { $_.BaseName } + Get-ChildItem $PSScriptRoot/../../src/Position-ExplorerWindow/public -Exclude *.Tests.ps1 | % { $_.BaseName } ) CmdletsToExport = @() VariablesToExport = @() diff --git a/src/Position-ExplorerWindow/Position-ExplorerWindow.psd1 b/src/Position-ExplorerWindow/Position-ExplorerWindow.psd1 index aa6ffb6..6305451 100644 --- a/src/Position-ExplorerWindow/Position-ExplorerWindow.psd1 +++ b/src/Position-ExplorerWindow/Position-ExplorerWindow.psd1 @@ -1,9 +1,9 @@ # -# Module manifest for module 'PSGet_Position-ExplorerWindow' +# Module manifest for module 'Position-ExplorerWindow' # # Generated by: The Oh Brothers # -# Generated on: 5/28/21 +# Generated on: 03/16/2024 # @{ @@ -45,7 +45,7 @@ PowerShellVersion = '2.0' # DotNetFrameworkVersion = '' # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# CLRVersion = '' +# ClrVersion = '' # Processor architecture (None, X86, Amd64) required by this module # ProcessorArchitecture = '' @@ -112,7 +112,7 @@ PrivateData = @{ # Prerelease string of this module # Prerelease = '' - # Flag to indicate whether the module requires explicit user acceptance for install/update + # Flag to indicate whether the module requires explicit user acceptance for install/update/save # RequireLicenseAcceptance = $false # External dependent modules of this module