Skip to content

Commit fb2f8fd

Browse files
committed
Only attempt to publish if versions differ from Gallery
1 parent 81d6ee3 commit fb2f8fd

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,31 @@ on:
33
push:
44
branches:
55
- master
6+
workflow_dispatch:
67
jobs:
78
build:
89
runs-on: windows-latest
910
steps:
1011
- uses: actions/checkout@v2
11-
- name: Pre Install Modules
12-
shell: pwsh
12+
- name: Install and cache PowerShell modules
13+
id: psmodulecache
14+
uses: potatoqualitee/psmodulecache@v4.5
15+
with:
16+
modules-to-cache: BuildHelpers, PowerShellBuild, psake, PSScriptAnalyzer, platyPS
17+
- shell: pwsh
18+
# Give an id to the step, so we can reference it later
19+
id: check_if_versions_bumped
1320
run: |
14-
Install-Module BuildHelpers -Scope CurrentUser -Force | Out-Null
15-
Install-Module PowerShellBuild -Scope CurrentUser -Force | Out-Null
16-
Install-Module psake -Scope CurrentUser -Force | Out-Null
17-
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force | Out-Null
18-
Install-Module platyPS -Scope CurrentUser -Force | Out-Null
21+
[version]$GalleryVersion = Get-NextNugetPackageVersion -Name Plaster -ErrorAction Stop
22+
[version]$GithubVersion = Get-MetaData -Path ./Plaster/Plaster.psd1 -PropertyName ModuleVersion -ErrorAction Stop
23+
$bumped = $GithubVersion -ge $GalleryVersion
24+
25+
# Set the output named "version_bumped"
26+
Write-Host "::set-output name=version_bumped::$bumped"
27+
28+
# Only publish (from master) if versions
1929
- name: Build and publish
30+
if: steps.check_if_versions_bumped.outputs.version_bumped == 'True'
2031
env:
2132
NUGET_KEY: ${{ secrets.NUGET_KEY }}
2233
shell: pwsh

0 commit comments

Comments
 (0)