Skip to content

Commit

Permalink
Added pre-release checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaydon committed Dec 4, 2018
1 parent ff0f413 commit dd27f87
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 9 deletions.
53 changes: 53 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,53 @@ jobs:
paths:
- ./*

pre-release-checks:
docker:
- image: microsoft/powershell:ubuntu-16.04
command: pwsh
steps:
- checkout
- run:
name: Check module version is newer than latest published to PowerShell Gallery
command: |
pwsh -Command '
if ((Test-ModuleManifest -Path ./Qlik-Cli.psd1).Version -le (Find-Module -Name Qlik-Cli).Version) {
Write-Error "Module version already exists"
}'
- run:
name: Check module version is newer than latest published to GitHub releases
command: |
pwsh -Command '
$password = ConvertTo-SecureString -String $env:GITHUB_TOKEN -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential("ahaydon", $password)
$release = Invoke-RestMethod `
-Method Get `
-Uri "https://api.github.com/repos/ahaydon/qlik-cli/releases/latest" `
-Credential $credential
if ((Test-ModuleManifest -Path ./Qlik-Cli.psd1).Version -le [System.Version]$release.tag_name) {
Write-Error "Module version must be newer than last published version" -ErrorAction Stop
}
$version = (Test-ModuleManifest -Path ./Qlik-Cli.psd1).Version
$release = $null
$null = try {
$release = Invoke-RestMethod `
-Method Get `
-Uri "https://api.github.com/repos/ahaydon/qlik-cli/releases/tags/$version" `
-Credential $credential `
-ErrorAction SilentlyContinue
} catch [System.Net.Http.HttpRequestException] {
if ($_.Exception.Response.StatusCode -ne "NotFound") {
Throw $_
}
$Error | Out-Null #clear the error so we exit cleanly
}
if ($release) {
Write-Error "Module version already exists" -ErrorAction Stop
}'
publish-powershell-gallery:
docker:
- image: microsoft/powershell:ubuntu-16.04
Expand Down Expand Up @@ -115,6 +162,12 @@ workflows:
test-and-deploy:
jobs:
- test
- pre-release-checks:
requires:
- test
filters:
branches:
only: testing
- publish-powershell-gallery:
requires:
- test
Expand Down
10 changes: 1 addition & 9 deletions Qlik-Cli.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@
RootModule = 'Qlik-Cli.psm1'

# Version number of this module.
<<<<<<< HEAD
<<<<<<< HEAD
ModuleVersion = '1.13.1'
=======
ModuleVersion = '1.13.2'
>>>>>>> origin/master
=======
ModuleVersion = '1.13.3'
>>>>>>> origin/master
ModuleVersion = '1.13.4'

# ID used to uniquely identify this module
GUID = '730275fa-35db-42e2-9400-eac7e3043ea4'
Expand Down

0 comments on commit dd27f87

Please sign in to comment.