-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* inject write-error * comment out publish * show manifest error * remove fail silently * debug path version * fix id typo * fixed list * fix needs * fix release prep again * write prereleasetag * get types * fix typo * fix typos * set tags as array * reset tags * debug w string * remove array * gc manifest * get childitem * write module path * Debug manifest * debug more * typecast to string * debug string concat * display hashtable * more debug details * tweak debugging * update install w prerelease * commenting * install required version * add debug * add debug * add version * use 1 if * hard code * install only * force it * remove install * add debug statements * see params * fix parameter set * fix comment typo * use binding * add comments * fix @ * remove cmdlet * uncomm param set * remove param sets * split into 2 * fix push paths * add env back * clean debug statement * fix pipeline issues * add output test * use write-output * clean up minor * back to previous version * use output * more output * use debug * more output * fix ps lint * test returning false * return to old error * hardcode params * fix step name * improve debug statements * back to write host * debug prerelease * changed info to host * switch tag version * write manifest out * update version * fix temp print * bump to 8 * add import back * require version * bump to 10 * bump vers * without tag * bump tag * use find mod * fix unit test * bump tag * trivial change to trigger tests * hide error * v 03 * fix pipeline * return false * add write error * remove details * be silent * be false * cleanup * unhardcode * Exclude Write-Host locally * commented out push trigger * comment out push trigger * update description
- Loading branch information
1 parent
8c185c8
commit 44e0184
Showing
7 changed files
with
366 additions
and
366 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Purpose: Publish nightly to a a private gallery just to make | ||
# sure that the code can be published. This is like a | ||
# smoke test. | ||
|
||
name: Publish Private Package | ||
|
||
on: | ||
schedule: | ||
- cron: "23 0 * * *" # Execute each day at 00:23 UTC | ||
workflow_dispatch: | ||
# for testing | ||
# push: | ||
# paths: | ||
# - ".github/workflows/publish_private_package.yaml" | ||
# - "utils/DeployUtils.ps1" | ||
|
||
env: | ||
GalleryName: PrivateScubaGearGallery | ||
|
||
jobs: | ||
publish: | ||
name: Publish to Private Gallery | ||
runs-on: windows-latest | ||
environment: Development | ||
permissions: | ||
id-token: write | ||
contents: write | ||
defaults: | ||
run: | ||
shell: powershell | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repo | ||
- name: Install Azure Signing Tool | ||
run: | | ||
dotnet --version | ||
dotnet tool install --global AzureSignTool --version 4.0.1 | ||
# OIDC Login to Azure Public Cloud with AzPowershell (enableAzPSSession true) | ||
- name: Login to Azure | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
enable-AzPSSession: true | ||
- name: Create Private Gallery | ||
run: | | ||
cd repo | ||
. utils/DeployUtils.ps1 | ||
New-PrivateGallery -GalleryName $env:GalleryName -Trusted | ||
- name: Get Key Vault Info | ||
id: key-vault-info | ||
env: | ||
KEY_VAULT_INFO: ${{ secrets.SCUBA_KEY_VAULT_PROD}} | ||
run: | | ||
$KeyVaultInfo = ${env:KEY_VAULT_INFO} | ConvertFrom-Json | ||
echo "KeyVaultUrl=$($KeyVaultInfo.KeyVault.URL)" >> $env:GITHUB_OUTPUT | ||
echo "KeyVaultCertificateName=$($KeyVaultInfo.KeyVault.CertificateName)" >> $env:GITHUB_OUTPUT | ||
- name: Sign and Publish Module | ||
uses: azure/powershell@v1 | ||
with: | ||
inlineScript: | | ||
# Source the deploy utilities so the functions in it can be called. | ||
. repo/utils/DeployUtils.ps1 | ||
# Remove non-release files | ||
Remove-Item -Recurse -Force repo -Include .git* | ||
# Setup the parameters | ||
$Parameters = @{ | ||
AzureKeyVaultUrl = '${{ steps.key-vault-info.outputs.KeyVaultUrl }}' | ||
CertificateName = '${{ steps.key-vault-info.outputs.KeyVaultCertificateName }}' | ||
ModulePath = 'repo/PowerShell/ScubaGear' | ||
GalleryName = $env:GalleryName | ||
} | ||
# This publishes to a private gallery. | ||
Publish-ScubaGearModule @Parameters | ||
azPSVersion: "latest" | ||
- name: Test Module Publish | ||
run: | | ||
Get-Location | ||
$TestContainers = @() | ||
$TestContainers += New-PesterContainer -Path "repo/Testing/Functional/BuildTest" -Data @{ } | ||
$PesterConfig = @{ | ||
Run = @{ | ||
Container = $TestContainers | ||
} | ||
Output = @{ | ||
Verbosity = 'Detailed' | ||
} | ||
} | ||
$Config = New-PesterConfiguration -Hashtable $PesterConfig | ||
Invoke-Pester -Configuration $Config | ||
# This is a manual test that writes the version to the console. | ||
- name: Print Scuba Version | ||
run: | | ||
Install-Module -Name ScubaGear -SkipPublisherCheck | ||
# Import-Module -Name ScubaGear | ||
Invoke-SCuBA -Version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Purpose: Publish on demand to the real gallery (PSGallery). | ||
|
||
name: Publish Public Package | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
OverrideModuleVersion: | ||
description: "Override the version of the release. Restricted to SemVer 1.0 - 3 segments" | ||
required: false | ||
type: string | ||
IsPrerelease: | ||
description: "Is this a prerelease" | ||
required: false | ||
type: boolean | ||
default: false | ||
PrereleaseTag: | ||
description: "The prerelease tag: (-)?[0-9A-Za-z]+ (e.g. -alpha1, -rc2, b1234)" | ||
required: false | ||
type: string | ||
# for testing | ||
# push: | ||
# paths: | ||
# - ".github/workflows/publish_public_package.yaml" | ||
# - "utils/DeployUtils.ps1" | ||
|
||
jobs: | ||
publish: | ||
name: Publish to PSGallery | ||
runs-on: windows-latest | ||
environment: Development | ||
permissions: | ||
id-token: write | ||
contents: write | ||
defaults: | ||
run: | ||
shell: powershell | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repo | ||
- name: Install Azure Signing Tool | ||
run: | | ||
dotnet --version | ||
dotnet tool install --global AzureSignTool --version 4.0.1 | ||
# OIDC Login to Azure Public Cloud with AzPowershell (enableAzPSSession true) | ||
- name: Login to Azure | ||
uses: azure/login@v1 | ||
with: | ||
client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
enable-AzPSSession: true | ||
- name: Get Key Vault info | ||
id: key-vault-info | ||
env: | ||
KEY_VAULT_INFO: ${{ secrets.SCUBA_KEY_VAULT_PROD}} | ||
run: | | ||
$KeyVaultInfo = ${env:KEY_VAULT_INFO} | ConvertFrom-Json | ||
echo "KeyVaultUrl=$($KeyVaultInfo.KeyVault.URL)" >> $env:GITHUB_OUTPUT | ||
echo "KeyVaultCertificateName=$($KeyVaultInfo.KeyVault.CertificateName)" >> $env:GITHUB_OUTPUT | ||
- name: Sign and Publish Module | ||
run: | | ||
# Source the deploy utilities so the functions in it can be called. | ||
. repo/utils/DeployUtils.ps1 | ||
# Remove non-release files | ||
Remove-Item -Recurse -Force repo -Include .git* | ||
# Extract the API key used to publish to PSGallery | ||
$ApiKey = az keyvault secret show --id '${{ steps.key-vault-info.outputs.KeyVaultUrl }}/secrets/ScubaGear-PSGAllery-API-Key' --query value -o tsv | ||
if (-Not $ApiKey) | ||
{ | ||
Write-Error "Failed to retrieve API key" | ||
} | ||
# Setup the parameters | ||
$Parameters = @{ | ||
AzureKeyVaultUrl = '${{ steps.key-vault-info.outputs.KeyVaultUrl }}' | ||
CertificateName = '${{ steps.key-vault-info.outputs.KeyVaultCertificateName }}' | ||
ModulePath = 'repo/PowerShell/ScubaGear' | ||
GalleryName = 'PSGallery' | ||
NuGetApiKey = $ApiKey | ||
} | ||
# if ('true' -eq '${{ inputs.IsPrerelease }}') | ||
# { | ||
# $Parameters.Add('PrereleaseTag', '${{ inputs.PrereleaseTag }}') | ||
# } | ||
# if (-Not [string]::IsNullOrEmpty('${{ inputs.OverrideModuleVersion }}')) | ||
# { | ||
# $Parameters.Add('OverrideModuleVersion', '${{ inputs.OverrideModuleVersion }}') | ||
# } | ||
# This publishes to PSGallery. | ||
Publish-ScubaGearModule @Parameters | ||
# This is a manual test that simply writes the version to the console | ||
- name: Print Scuba Version | ||
run: | | ||
if ('true' -eq '${{ inputs.IsPrerelease }}') | ||
{ | ||
$Version = '${{ inputs.OverrideModuleVersion }}' + '${{ inputs.PrereleaseTag }}' | ||
Write-Host "Checking for prerelease with required version: " + $Version | ||
Find-Module -Name ScubaGear -RequiredVersion $Version -AllowPrerelease | ||
} | ||
else | ||
{ | ||
Write-Host "Installing latest version" | ||
Find-Module -Name ScubaGear | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.