Skip to content
This repository was archived by the owner on May 18, 2024. It is now read-only.

Commit 0197af1

Browse files
committed
Adds new pipline to prepare release
1 parent d75d22e commit 0197af1

File tree

2 files changed

+52
-11
lines changed

2 files changed

+52
-11
lines changed

.github/workflows/prepare-release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "[Prototype] Prepare Release"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Use Node.js 20
11+
uses: actions/setup-node@v4
12+
with:
13+
node-version: 20
14+
registry-url: 'https://registry.npmjs.org'
15+
- name: Checkout PnP PowerShell VS Code Extension
16+
uses: actions/checkout@v4
17+
with:
18+
path: pnp-powershell-extension
19+
- name: Checkout PnP PowerShell
20+
uses: actions/checkout@v4
21+
with:
22+
repository: pnp/powershell
23+
path: powershell
24+
- name: Checkout PnP Script Samples
25+
uses: actions/checkout@v4
26+
with:
27+
repository: pnp/script-samples
28+
path: script-samples
29+
- name: Run create script samples script
30+
run: .\pnp-powershell-extension\scripts\createScriptSampleDefenition.ps1 -PathToWorkspace ".\"
31+
shell: pwsh
32+
continue-on-error: false
33+
- name: Create Pull Request
34+
uses: peter-evans/create-pull-request@v5
35+
with:
36+
path: pnp-powershell-extension
37+
commit-message: prepare release
38+
branch: prepare-release
39+
title: Prepare Release
40+
body: Prepare Release
41+
...

scripts/createScriptSampleDefenition.ps1

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
param ($scriptSampleFolderPath)
1+
param (
2+
[Parameter(Mandatory = $true)]
3+
[string]$PathToWorkspace
4+
)
25

3-
if ($null -eq $scriptSampleFolderPath -or $scriptSampleFolderPath -eq "") {
4-
write-host "Please pass path to script samples from pnp/script-sample repo"
5-
exit
6-
}
7-
8-
$allSamples = Get-ChildItem -Path "$scriptSampleFolderPath\scripts\**\sample.json" -Recurse -Force
6+
$allSamples = Get-ChildItem -Path "$PathToWorkspace\script-samples\scripts\**\sample.json" -Recurse -Force
97

108
[hashtable]$sampleModel = @{}
119
$samples = @()
@@ -31,10 +29,10 @@ foreach ($sample in $allSamples) {
3129
$rawUrl = $rawUrl.Replace('.html', '.md')
3230

3331
$sampleAuthors = @()
34-
foreach($author in $sampleJson.authors) {
32+
foreach ($author in $sampleJson.authors) {
3533
$sampleAuthors += [pscustomobject]@{
36-
name = $author.name;
37-
pictureUrl = $author.pictureUrl;
34+
name = $author.name;
35+
pictureUrl = $author.pictureUrl;
3836
}
3937
}
4038

@@ -53,7 +51,9 @@ foreach ($sample in $allSamples) {
5351

5452
$sampleModel.Add('samples', $samples)
5553
$orderedSampleModel = [ordered]@{}
54+
5655
foreach ($Item in ($sampleModel.GetEnumerator() | Sort-Object -Property Key)) {
5756
$orderedSampleModel[$Item.Key] = $Item.Value
5857
}
59-
New-Object -TypeName psobject -Property $orderedSampleModel | ConvertTo-Json -Depth 10 | Out-File "..\data\samples.json"
58+
59+
New-Object -TypeName psobject -Property $orderedSampleModel | ConvertTo-Json -Depth 10 | Out-File "$PathToWorkspace\pnp-powershell-extension\data\samples.json"

0 commit comments

Comments
 (0)