Skip to content

Commit 6e2568f

Browse files
committed
feat: init template src
1 parent 980e6b0 commit 6e2568f

26 files changed

+11858
-2
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
9+
# Matches multiple files with brace expansion notation
10+
# Set default charset
11+
[*.{config,nuspec,ps1,yml}]
12+
charset = utf-8
13+
14+
[*.ps1]
15+
indent_style = space
16+
indent_size = 4
17+
18+
[*.{config,nuspec,yml}]
19+
indent_style = space
20+
indent_size = 2

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.* eol=lf
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: compendium.powershell pipeline
2+
on:
3+
push:
4+
pull_request:
5+
branches:
6+
- main
7+
concurrency:
8+
group: ${{ github.ref }}
9+
cancel-in-progress: true
10+
env:
11+
PACKAGE_NAME: Compendium.PowerShell.nupkg
12+
ARTIFACT_NAME: Compendium.PowerShell
13+
NODE_VERSION: '18'
14+
NUGET_VERSION: '6.5.0'
15+
defaults:
16+
run:
17+
shell: pwsh
18+
jobs:
19+
SemanticVersion:
20+
runs-on: ubuntu-latest
21+
outputs:
22+
semantic_version: ${{ steps.semantic_release.outputs.SEMANTIC_VERSION }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
with:
27+
persist-credentials: false
28+
- name: Setup Node Version
29+
uses: actions/setup-node@master
30+
with:
31+
node-version: ${{ env.NODE_VERSION }}
32+
- name: Node Package Restore
33+
run: ./build/scripts/Install-NodePackages.ps1
34+
- name: Semantic Release (Dry-Run)
35+
id: semantic_release
36+
run: ./build/scripts/Invoke-SemanticRelease.ps1 -DryRun
37+
env:
38+
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
39+
GH_REF: ${{ github.ref }}
40+
Test:
41+
runs-on: ubuntu-latest
42+
defaults:
43+
run:
44+
shell: pwsh
45+
working-directory: src/Compendium.PowerShell/module
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
with:
50+
persist-credentials: false
51+
- name: terraform init
52+
run: ./../../../build/scripts/Initialize-Terraform.ps1
53+
Build:
54+
runs-on: ubuntu-latest
55+
needs:
56+
- SemanticVersion
57+
- Test
58+
defaults:
59+
run:
60+
shell: pwsh
61+
working-directory: src
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v3
65+
- uses: nuget/setup-nuget@v1
66+
with:
67+
nuget-version: ${{ env.NUGET_VERSION }}
68+
- name: Package Template
69+
run: ./../build/scripts/Export-Package.ps1 -Nuspec "Compendium.PowerShell.nuspec" -SemanticVersion "${{ needs.SemanticVersion.outputs.semantic_version }}"
70+
- name: Publish Artifact
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: ${{ env.ARTIFACT_NAME }}
74+
path: src/${{ env.PACKAGE_NAME }}
75+
Release:
76+
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
77+
runs-on: ubuntu-latest
78+
needs:
79+
- SemanticVersion
80+
- Build
81+
defaults:
82+
run:
83+
shell: pwsh
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v3
87+
- name: Download Artifact
88+
uses: actions/download-artifact@v3
89+
with:
90+
name: ${{ env.ARTIFACT_NAME }}
91+
path: a/${{ env.ARTIFACT_NAME }}
92+
- uses: nuget/setup-nuget@v1
93+
with:
94+
nuget-api-key: ${{ secrets.NUGETAPIKEY }}
95+
nuget-version: ${{ env.NUGET_VERSION }}
96+
- name: Setup Node Version
97+
uses: actions/setup-node@master
98+
with:
99+
node-version: ${{ env.NODE_VERSION }}
100+
- name: Node Package Restore
101+
run: ./build/scripts/Install-NodePackages.ps1
102+
- name: Semantic Release
103+
id: semantic_release
104+
run: ./build/scripts/Invoke-SemanticRelease.ps1
105+
env:
106+
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
107+
GH_REF: ${{ github.ref }}
108+
- name: Publish Package
109+
run: |
110+
./build/scripts/Publish-Package.ps1 -PackagePath "a/${{ env.ARTIFACT_NAME }}/${{ env.PACKAGE_NAME }}"
111+
env:
112+
NUGETSOURCE: ${{ vars.NUGETSOURCE }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.nupkg
2+
node_modules

.releaserc.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
branches:
2+
- main
3+
4+
plugins:
5+
- path: "@semantic-release/commit-analyzer"
6+
preset: conventionalcommits
7+
releaseRules:
8+
- type: docs
9+
release: patch
10+
- type: refactor
11+
release: patch
12+
- path: "@semantic-release/release-notes-generator"
13+
preset: conventionalcommits
14+
- path: "@semantic-release/changelog"
15+
- path: "@semantic-release/exec"
16+
verifyReleaseCmd: "echo '${nextRelease.version}' > SEMANTIC-VERSION.txt"
17+
generateNotesCmd: "echo '${nextRelease.notes}' > RELEASE-NOTES.md"
18+
- path: "@semantic-release/github"
19+
assets:
20+
- path: a/Compendium.PowerShell/Compendium.PowerShell.nupkg
21+
label: Compendium.PowerShell.nupkg
22+
- path: "@semantic-release/git"
23+
assets:
24+
- CHANGELOG.md
25+
- RELEASE-NOTES.md

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Richard
3+
Copyright (c) 2023 Richard Bolhofer
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1-
# dotnet-template-compendium-powershell
1+
# Compendium.PowerShell Template
2+
23
Custom PowerShell template for dotnet new.
4+
5+
# Local Testing
6+
7+
```powershell
8+
nuget pack Compendium.PowerShell.nuspec -NoDefaultExcludes -OutputFileNamesWithoutVersion -Version 1.0.0
9+
dotnet new install Compendium.PowerShell.nupkg
10+
dotnet new uninstall Compendium.PowerShell
11+
```

build/scripts/Export-Package.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
param (
2+
[String] $Nuspec,
3+
[string] $SemanticVersion
4+
)
5+
6+
nuget pack $Nuspec -NoDefaultExcludes -OutputFileNamesWithoutVersion -Version $SemanticVersion
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm install
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
param(
2+
[switch] $DryRun
3+
)
4+
5+
if($env:GH_REF -eq 'refs/heads/main') {
6+
if($DryRun) {
7+
npx semantic-release --dry-run
8+
}
9+
else {
10+
npx semantic-release
11+
}
12+
13+
Write-Output "SEMANTIC_VERSION=$(Get-Content -Path 'SEMANTIC-VERSION.txt')" >> $env:GITHUB_OUTPUT
14+
}
15+
else {
16+
Write-Output "SEMANTIC_VERSION=0.0.1" >> $env:GITHUB_OUTPUT
17+
}

0 commit comments

Comments
 (0)