-
Notifications
You must be signed in to change notification settings - Fork 6
138 lines (122 loc) · 5.72 KB
/
master.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Build and Publish VSIX - Manage-AutomationAccount - azure pipeline task
on:
push:
branches:
- master
paths:
- 'vss-extension.json'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.x'
- name: Install Node.js
run: |
choco install nodejs -y -Force
- name: Install tfx-cli
run: |
npm install -g tfx-cli
npm install -g uuid@latest
- name: Download VstsTaskSdk
shell: pwsh
run: |
$sdkFolder = [System.IO.Path]::Combine($env:GITHUB_WORKSPACE, 'sdkTask')
$packageInfo = Save-package -Name VstsTaskSdk -Path $sdkFolder -Force
$sdk = [System.IO.Path]::Combine($sdkFolder, $packageInfo.Name)
Move-Item -Path ([System.IO.Path]::Combine($sdk, $($packageInfo.Version), '*')) -Destination $sdk
Remove-Item ([System.IO.Path]::Combine($sdk, $($packageInfo.Version))) -Force -Recurse
Write-Host "Downloaded SDK $($packageInfo.Name) version $($packageInfo.Version) to $sdkFolder"
#save for next step
"taskSdk=$sdk" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install Task Sdk to tasks
shell: pwsh
run: |
# Install VstsTaskSdk for tasks defined in Tasks folder
$sdk = $env:taskSdk
$tasksFolder = [System.IO.Path]::Combine($env:GITHUB_WORKSPACE,'Tasks')
$tasks = Get-ChildItem $tasksFolder -Directory
foreach($task in $tasks.Name)
{
Write-Host "Installing Tasks SDK to $task"
Copy-Item -Path $sdk -Destination ([System.IO.Path]::Combine($tasksFolder,$task,'ps_modules','VstsTaskSdk')) -Force -Recurse
# Copy Module folder to each task subfolder
Copy-Item -Path "$env:GITHUB_WORKSPACE\Module" -Destination ([System.IO.Path]::Combine($env:GITHUB_WORKSPACE,'Tasks',$task)) -Recurse -Force
}
- name: Set tasks version
shell: pwsh
run: |
$tasksFolder = [System.IO.Path]::Combine($env:GITHUB_WORKSPACE,'Tasks')
$extensionInfo = get-content ([System.IO.Path]::Combine($env:GITHUB_WORKSPACE, 'vss-extension.json')) | ConvertFrom-Json -Depth 99
$extensionVersion = [System.Version]::Parse($extensionInfo.version)
$versionInfo =[ordered]@{
Major = $extensionVersion.Major
Minor = $extensionVersion.Minor
Patch = $extensionVersion.Build
}
$tasks = Get-ChildItem $tasksFolder -Directory
foreach($task in $tasks.Name)
{
Write-Host "Setting version of task $task to $extensionVersion"
$taskInfo = get-content ([System.IO.Path]::Combine($tasksFolder,$task,'task.json')) | ConvertFrom-Json -Depth 99
$taskInfo.version = $versionInfo
switch ($task) {
"Manage-AutomationAccount" {
# update task name based on developlment flag
if ($extensionInfo.isDevelopment -eq "true") {
$taskInfo.id = "89d6f3bb-b859-4c17-9a62-aa087baf6f57"
$taskInfo.name = "Dev-Manage-AutomationAccount"
$taskInfo.friendlyName = "Dev-Manage-AutomationAccount"
}
else {
$taskInfo.id = "c3e84ba0-be86-11ee-aff3-5d686ed5c05d"
$taskInfo.name = "Manage-AutomationAccount"
$taskInfo.friendlyName = "Manage-AutomationAccount"
}
}
"Manage-AutomationWebHook" {
if ($extensionInfo.isDevelopment -eq "true") {
$taskInfo.id = "d9e1b487-6a6f-47b5-8105-b8efc07c8d7e"
$taskInfo.name = "Dev-Manage-AutomationWebHook"
$taskInfo.friendlyName = "Dev-Manage-AutomationWebHook"
}
else {
$taskInfo.id = "c3e84ba0-be86-11ee-aff3-5d686ed5c05f"
$taskInfo.name = "Manage-AutomationWebHook"
$taskInfo.friendlyName = "Manage-AutomationWebHook"
}
}
}
$taskInfo | ConvertTo-Json -Depth 99 | Out-File -Path ([System.IO.Path]::Combine($tasksFolder,$task,'task.json')) -Force
}
# Add galleryFlags property
if (-not $extensionInfo.galleryFlags) {
$extensionInfo | Add-Member -MemberType NoteProperty -Name "galleryFlags" -Value @()
}
if ($extensionInfo.isDevelopment -eq "true") {
Write-Host "Generating development non-public VSIX package..."
# Add "Preview" to "galleryFlags"
$extensionInfo.galleryFlags = @("Preview")
$extensionInfo.id = "Dev-Manage-AutomationAccount"
$extensionInfo.name = "Dev-Manage-AutomationAccount"
} else {
Write-Host "Generating public VSIX package..."
# Add "Public" to "galleryFlags"
$extensionInfo.galleryFlags = @("Public")
$extensionInfo.id = "Manage-AutomationAccount"
$extensionInfo.name = "Manage-AutomationAccount"
}
# Save new data to json file
$extensionInfo | ConvertTo-Json -Depth 99 | Set-Content -Path ([System.IO.Path]::Combine($env:GITHUB_WORKSPACE, 'vss-extension.json'))
Write-Host "Show vss-extension.json file content"
$extensionInfo
- name: Generate and Upload VSIX file
env:
NODE_AUTH_TOKEN: ${{ secrets.PAT_ROMAN_MANAGE_AUTOMATION_ACCOUNT }}
run: |
Write-Host "Start generate and upload VSIX file..."
tfx extension publish --publisher GreyCorbelSolutions --manifest-globs vss-extension.json --token $env:NODE_AUTH_TOKEN