Skip to content

Commit f088f2f

Browse files
committed
Initial GitSplit module scaffold
0 parents  commit f088f2f

9 files changed

Lines changed: 1581 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: Pester
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Install Pester
18+
shell: pwsh
19+
run: |
20+
Set-StrictMode -Version Latest
21+
$ErrorActionPreference = 'Stop'
22+
23+
# Use Pester v5+ explicitly.
24+
Install-Module Pester -Force -Scope CurrentUser -MinimumVersion 5.0.0
25+
26+
- name: Run tests
27+
shell: pwsh
28+
run: |
29+
Set-StrictMode -Version Latest
30+
$ErrorActionPreference = 'Stop'
31+
32+
Invoke-Pester -Path "./GitSplit.Tests.ps1" -CI -Output Detailed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Publish to PowerShell Gallery
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
test:
10+
name: Pester
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Install Pester
18+
shell: pwsh
19+
run: |
20+
Set-StrictMode -Version Latest
21+
$ErrorActionPreference = 'Stop'
22+
Install-Module Pester -Force -Scope CurrentUser -MinimumVersion 5.0.0
23+
24+
- name: Run tests
25+
shell: pwsh
26+
run: |
27+
Set-StrictMode -Version Latest
28+
$ErrorActionPreference = 'Stop'
29+
Invoke-Pester -Path "./GitSplit.Tests.ps1" -CI -Output Detailed
30+
31+
publish:
32+
name: Publish
33+
runs-on: ubuntu-latest
34+
needs: [ test ]
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
40+
- name: Publish to PSGallery
41+
shell: pwsh
42+
env:
43+
PSGALLERY_API_KEY: ${{ secrets.PSGALLERY_API_KEY }}
44+
run: |
45+
Set-StrictMode -Version Latest
46+
$ErrorActionPreference = 'Stop'
47+
48+
if (-not $env:PSGALLERY_API_KEY) {
49+
throw 'Missing secret PSGALLERY_API_KEY'
50+
}
51+
52+
$moduleName = 'GitSplit'
53+
$manifestPath = Join-Path $PWD "$moduleName.psd1"
54+
55+
if (-not (Test-Path $manifestPath)) {
56+
throw "Manifest not found at $manifestPath"
57+
}
58+
59+
$manifest = Import-PowerShellDataFile -Path $manifestPath
60+
$version = [string]$manifest.ModuleVersion
61+
62+
$tag = ($env:GITHUB_REF -replace '^refs/tags/', '')
63+
if ($tag -ne "v$version") {
64+
throw "Tag '$tag' must match manifest ModuleVersion 'v$version'"
65+
}
66+
67+
# Publish-Module expects the module in a folder named after the module.
68+
$stagingRoot = Join-Path $env:RUNNER_TEMP 'psgallery'
69+
$moduleFolder = Join-Path $stagingRoot $moduleName
70+
New-Item -Path $moduleFolder -ItemType Directory -Force | Out-Null
71+
72+
Copy-Item -Path "$moduleName.psm1" -Destination $moduleFolder -Force
73+
Copy-Item -Path "$moduleName.psd1" -Destination $moduleFolder -Force
74+
if (Test-Path 'LICENSE') { Copy-Item -Path 'LICENSE' -Destination $moduleFolder -Force }
75+
if (Test-Path 'README.md') { Copy-Item -Path 'README.md' -Destination $moduleFolder -Force }
76+
77+
Publish-Module -Path $moduleFolder -NuGetApiKey $env:PSGALLERY_API_KEY -Repository PSGallery

‎.gitignore‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# PowerShell / Pester
2+
/testResults.xml
3+
4+
# Test artifacts
5+
/temprepo/
6+
7+
# OS
8+
.DS_Store

0 commit comments

Comments
 (0)