Skip to content

Commit 56e54bc

Browse files
committed
Updating ci workflow and adding publish workflow.
1 parent 87fc96d commit 56e54bc

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

.github/workflows/CI.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ jobs:
1010
os: [ubuntu-latest, windows-latest, macOS-latest]
1111
steps:
1212
- uses: actions/checkout@v1
13+
- name: Install and cache PowerShell modules
14+
id: psmodulecache
15+
uses: potatoqualitee/psmodulecache@v6.2.1
16+
with:
17+
modules-to-cache: BuildHelpers, Pester, psake, PowerShellBuild, PSScriptAnalyzer, powershell-yaml
18+
- name: Build
19+
shell: pwsh
20+
run: ./build.ps1 -Task Build
1321
- name: Test
1422
shell: pwsh
15-
run: ./build.ps1 -Task Test -Bootstrap
23+
run: ./build.ps1 -Task Test
1624

.github/workflows/publish.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Module
2+
on:
3+
push:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
jobs:
8+
build:
9+
runs-on: windows-latest
10+
steps:
11+
# Get the current version
12+
- uses: actions/checkout@v3
13+
- name: Install and cache PowerShell modules
14+
id: psmodulecache
15+
uses: potatoqualitee/psmodulecache@v6.2.1
16+
with:
17+
modules-to-cache: BuildHelpers, Pester, psake, PowerShellBuild, PSScriptAnalyzer, powershell-yaml
18+
- shell: pwsh
19+
# Give an id to the step, so we can reference it later
20+
id: check_if_versions_bumped
21+
run: |
22+
[version]$GalleryVersion = Get-NextNugetPackageVersion -Name PSTestableData -ErrorAction Stop
23+
[version]$GithubVersion = Get-MetaData -Path ./PSTestableData/PSTestableData.psd1 -PropertyName ModuleVersion -ErrorAction Stop
24+
$bumped = $GithubVersion -ge $GalleryVersion
25+
26+
# Set the output named "version_bumped"
27+
Write-Host "::set-output name=version_bumped::$bumped"
28+
29+
- name: Publish to PSGallery
30+
shell: pwsh
31+
if: steps.check_if_versions_bumped.outputs.version_bumped == 'True'
32+
env:
33+
PSGALLERY_API_KEY: ${{ secrets.PS_GALLERY_KEY }}
34+
run: ./build.ps1 -Task Publish

0 commit comments

Comments
 (0)