* Stage files

* fix pipeline trigger

* separated tests from source

* cleaned up paths in CD trigger

* use wildcard in trigger

* Improved CI trigger

* Fix staging and remove WhatIf

* Trigger CD if License changes

* better ci rules
format-checklist-fix
Chris Kuech 2019-09-12 18:51:53 -07:00 committed by GitHub
parent cd05c0fffb
commit 0c2562f474
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 53 additions and 10 deletions

View File

@ -5,11 +5,24 @@
$InformationPreference = "Continue"
# static version parts
$Major = 2
$Minor = 2
# paths
$RepoRoot = "$PSScriptRoot/../.."
$ModuleManifestPath = "$RepoRoot/Requirements.psd1"
$StagingRoot = "$PSScriptRoot/stage"
##
# Stage source files
#
New-Item -ItemType Directory -Path $StagingRoot
Copy-Item -Path "$RepoRoot/LICENSE", "$RepoRoot/src" -Destination $StagingRoot -Recurse
##
# Derive version string
#
$current = [Version](Find-Module Requirements).Version
@ -17,8 +30,16 @@ $newMinor = [version]"$Major.$Minor.0" # the version to use if we incremented Mi
$newBuild = [version]"$Major.$Minor.$($current.Build + 1)" # the version to use if we increment Build
$new = if ($newMinor -gt $current) { $newMinor } else { $newBuild }
$template = Get-Content $ModuleManifestPath -Raw
$expanded = $template -replace "{{ModuleVersion}}", $new
$expanded | Out-File $ModuleManifestPath -Force
##
# Expand manifest template
#
Publish-Module -Path $RepoRoot -NuGetApiKey $env:PSGALLERY_NUGET_API_KEY -WhatIf
$template = Get-Content "$RepoRoot/Requirements.psd1" -Raw
$expanded = $template -replace "{{ModuleVersion}}", $new
$expanded | Out-File "$StagingRoot/Requirements.psd1" -Force
##
# Publish the module
#
Publish-Module -Path $StagingRoot -NuGetApiKey $env:PSGALLERY_NUGET_API_KEY

View File

@ -1,6 +1,13 @@
name: CD
on: deployment
on:
push:
branches:
- master
paths:
- "Requirements.psd1"
- "LICENSE"
- "src/*"
jobs:
validate:

View File

@ -1,6 +1,10 @@
name: CI
on: push
on:
push:
branches:
- "*"
- "!master"
jobs:
validate:

View File

@ -1,5 +1,9 @@
."$PSScriptRoot\core.ps1"
$ErrorActionPreference = "Stop"
$RepoRoot = "$PSScriptRoot/.."
$SourceRoot = "$RepoRoot/src"
."$SourceRoot\core.ps1"
Describe "Core" {
Context "applyRequirement" {

View File

@ -1,5 +1,9 @@
."$PSScriptRoot\formatters.ps1"
$ErrorActionPreference = "Stop"
$RepoRoot = "$PSScriptRoot/.."
$SourceRoot = "$RepoRoot/src"
."$SourceRoot\formatters.ps1"
function invoke($Requirement) {
[RequirementEvent]::new($Requirement, "Test", "Start")

View File

@ -1,6 +1,9 @@
$ErrorActionPreference = "Stop"
."$PSScriptRoot\interface.ps1"
$RepoRoot = "$PSScriptRoot/.."
$SourceRoot = "$RepoRoot/src"
."$SourceRoot\interface.ps1"
$PlatformLacksDscSupport = $PSVersionTable.PSEdition -eq "Core"
if (-not $PlatformLacksDscSupport) {