-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (122 loc) · 5.8 KB
/
Automation Master SDK Workflow.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
name: Automation Master Workflow
# Controls when the workflow will run
on:
# Allows you to run this workflow from another workflow
workflow_call:
outputs:
quality_gate:
description: "Results from Skyline Quality Gate."
value: ${{ jobs.validate_skyline_quality_gate.outputs.quality }}
#artifact-id-release:
artifact-id:
description: "Artifact ID of uploaded Package if successful."
value: ${{ jobs.artifact_creation_registration.outputs.artifact-id }}
# artifact-id-development:
# description: "Artifact ID of dev uploaded Package if successful."
inputs:
referenceName:
required: true
type: string
runNumber:
required: true
type: string
referenceType:
required: true
type: string
repository:
required: true
type: string
owner:
required: true
type: string
sonarCloudProjectName:
required: true
type: string
secrets:
api-key:
required: false
sonarCloudToken:
required: true
azureToken:
required: false
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
artifact_creation:
name: Artifact Creation
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Find .sln file
id: findSlnFile
run: |
echo solutionFilePath=$(find . -type f -name '*.sln') >> $GITHUB_OUTPUT
shell: bash
# TODO: Refactor this in the future to a single stage with a loop that adds all the sources you specify.
- name: Enable Skyline GitHub NuGet Registry
if: inputs.owner == 'SkylineCommunications'
run: |
$SOURCE_NAME="PrivateGitHubNugets"
$SOURCE_URL="https://nuget.pkg.github.com/SkylineCommunications/index.json"
# Check if the source exists. If it does, update it.
if (dotnet nuget list source | Select-String -Pattern $SOURCE_NAME) {
Write-Host "Updating existing source $SOURCE_NAME."
dotnet nuget update source $SOURCE_NAME --source $SOURCE_URL --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
} else {
Write-Host "Adding new source $SOURCE_NAME."
dotnet nuget add source $SOURCE_URL --name $SOURCE_NAME --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
}
shell: pwsh
- name: Enable Skyline Azure Cloud NuGet Registry
env:
AZURE_TOKEN_EXISTS: ${{ secrets.azureToken }}
if: env.AZURE_TOKEN_EXISTS != null && inputs.owner == 'SkylineCommunications'
run: |
$SOURCE_NAME="CloudNuGets"
$SOURCE_URL="https://pkgs.dev.azure.com/skyline-cloud/Cloud_NuGets/_packaging/CloudNuGet/nuget/v3/index.json"
# Check if the source exists. If it does, update it.
if (dotnet nuget list source | Select-String -Pattern $SOURCE_NAME) {
Write-Host "Updating existing source $SOURCE_NAME."
dotnet nuget update source $SOURCE_NAME --source $SOURCE_URL --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
} else {
Write-Host "Adding new source $SOURCE_NAME."
dotnet nuget add source $SOURCE_URL --name $SOURCE_NAME --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
}
shell: pwsh
- name: Enable Skyline Azure Private NuGet Registry
env:
AZURE_TOKEN_EXISTS: ${{ secrets.azureToken }}
if: env.AZURE_TOKEN_EXISTS != null && inputs.owner == 'SkylineCommunications'
run: |
$SOURCE_NAME="PrivateAzureNuGets"
$SOURCE_URL="https://pkgs.dev.azure.com/skyline-cloud/_packaging/skyline-private-nugets/nuget/v3/index.json"
# Check if the source exists. If it does, update it.
if (dotnet nuget list source | Select-String -Pattern $SOURCE_NAME) {
Write-Host "Updating existing source $SOURCE_NAME."
dotnet nuget update source $SOURCE_NAME --source $SOURCE_URL --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
} else {
Write-Host "Adding new source $SOURCE_NAME."
dotnet nuget add source $SOURCE_URL --name $SOURCE_NAME --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
}
shell: pwsh
- name: NuGet restore solution
run: dotnet restore "${{ steps.findSlnFile.outputs.solutionFilePath }}"
- name: Install .NET Tools
run: |
dotnet tool install -g Skyline.DataMiner.CICD.Tools.Packager
- name: Create package name
id: packageName
run: |
tempName="${{ inputs.repository }}"
echo name=${tempName//[\"\/\\<>|:*?]/_} >> $GITHUB_OUTPUT
shell: bash
- name: Create dmapp package
if: inputs.referenceType == 'tag'
run: dataminer-package-create dmapp "${{ github.workspace }}" --type automation --version ${{ inputs.referenceName }} --output "${{ github.workspace }}" --name "${{ steps.packageName.outputs.name }}"
- name: Create dmapp package
if: inputs.referenceType != 'tag'
run: dataminer-package-create dmapp "${{ github.workspace }}" --type automation --build-number ${{ inputs.runNumber }} --output "${{ github.workspace }}" --name "${{ steps.packageName.outputs.name }}"
- uses: actions/upload-artifact@v4
with:
name: DataMiner Installation Package
path: "${{ github.workspace }}/${{ steps.packageName.outputs.name }}.dmapp"