Skip to content

Commit d611364

Browse files
committed
release action
1 parent d34e308 commit d611364

File tree

2 files changed

+10
-235
lines changed

2 files changed

+10
-235
lines changed

.github/workflows/Automation Master SDK Workflow.yml

+1-230
Original file line numberDiff line numberDiff line change
@@ -43,177 +43,6 @@ on:
4343

4444
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
4545
jobs:
46-
validate_skyline_quality_gate:
47-
name: SDK Skyline Quality Gate
48-
runs-on: windows-latest
49-
env:
50-
detected-unit-tests: none
51-
outputs:
52-
quality: ${{ steps.quality-step.outputs.results }}
53-
steps:
54-
- uses: actions/checkout@v4
55-
with:
56-
fetch-depth: 0
57-
58-
- name: Initialize
59-
run: |
60-
echo "workspace" ${{ github.workspace }}
61-
echo "ref name" ${{ inputs.referenceName }}
62-
echo "run number" ${{ inputs.runNumber }}
63-
echo "ref type" ${{ inputs.referenceType }}
64-
echo "repository" ${{ inputs.repository }}
65-
66-
- name: Set up JDK 17
67-
uses: actions/setup-java@v4
68-
with:
69-
java-version: 17
70-
distribution: 'zulu'
71-
72-
- name: Find .sln file
73-
id: findSlnFile
74-
run: |
75-
echo solutionFilePath=$(find . -type f -name '*.sln') >> $GITHUB_OUTPUT
76-
shell: bash
77-
- name: Detect .csproj files
78-
id: detectCsprojFiles
79-
run: |
80-
$csprojFileCount = Get-ChildItem . -Recurse -File -Filter *.csproj | Measure-Object | Select-Object -ExpandProperty Count
81-
$result = "false"
82-
if($csprojFileCount -gt 0){ $result = "true" }
83-
Write-Output "csproj-file-present=$($result)" >> $Env:GITHUB_OUTPUT
84-
shell: pwsh
85-
# TODO: Refactor this in the future to a single stage with a loop that adds all the sources you specify.
86-
- name: Enable Skyline GitHub NuGet Registry
87-
if: inputs.owner == 'SkylineCommunications'
88-
run: |
89-
$SOURCE_NAME="PrivateGitHubNugets"
90-
$SOURCE_URL="https://nuget.pkg.github.com/SkylineCommunications/index.json"
91-
92-
# Check if the source exists. If it does, update it.
93-
if (dotnet nuget list source | Select-String -Pattern $SOURCE_NAME) {
94-
Write-Host "Updating existing source $SOURCE_NAME."
95-
dotnet nuget update source $SOURCE_NAME --source $SOURCE_URL --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
96-
} else {
97-
Write-Host "Adding new source $SOURCE_NAME."
98-
dotnet nuget add source $SOURCE_URL --name $SOURCE_NAME --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
99-
}
100-
shell: pwsh
101-
102-
- name: Enable Skyline Azure Cloud NuGet Registry
103-
env:
104-
AZURE_TOKEN_EXISTS: ${{ secrets.azureToken }}
105-
if: env.AZURE_TOKEN_EXISTS != null && inputs.owner == 'SkylineCommunications'
106-
run: |
107-
$SOURCE_NAME="CloudNuGets"
108-
$SOURCE_URL="https://pkgs.dev.azure.com/skyline-cloud/Cloud_NuGets/_packaging/CloudNuGet/nuget/v3/index.json"
109-
110-
# Check if the source exists. If it does, update it.
111-
if (dotnet nuget list source | Select-String -Pattern $SOURCE_NAME) {
112-
Write-Host "Updating existing source $SOURCE_NAME."
113-
dotnet nuget update source $SOURCE_NAME --source $SOURCE_URL --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
114-
} else {
115-
Write-Host "Adding new source $SOURCE_NAME."
116-
dotnet nuget add source $SOURCE_URL --name $SOURCE_NAME --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
117-
}
118-
119-
- name: Enable Skyline Azure Private NuGet Registry
120-
env:
121-
AZURE_TOKEN_EXISTS: ${{ secrets.azureToken }}
122-
if: env.AZURE_TOKEN_EXISTS != null && inputs.owner == 'SkylineCommunications'
123-
run: |
124-
$SOURCE_NAME="PrivateAzureNuGets"
125-
$SOURCE_URL="https://pkgs.dev.azure.com/skyline-cloud/_packaging/skyline-private-nugets/nuget/v3/index.json"
126-
127-
# Check if the source exists. If it does, update it.
128-
if (dotnet nuget list source | Select-String -Pattern $SOURCE_NAME) {
129-
Write-Host "Updating existing source $SOURCE_NAME."
130-
dotnet nuget update source $SOURCE_NAME --source $SOURCE_URL --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
131-
} else {
132-
Write-Host "Adding new source $SOURCE_NAME."
133-
dotnet nuget add source $SOURCE_URL --name $SOURCE_NAME --username az --password ${{ secrets.azureToken }} --store-password-in-clear-text
134-
}
135-
136-
- name: Building
137-
if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true'
138-
run: dotnet build "${{ steps.findSlnFile.outputs.solutionFilePath }}" -p:DefineConstants="DCFv1%3BDBInfo%3BALARM_SQUASHING" --configuration Release -nodeReuse:false
139-
140-
- name: Unit Tests
141-
# when not using MSTest you'll need to install coverlet.collector nuget in your test solutions
142-
id: unit-tests
143-
if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true'
144-
run: dotnet test "${{ steps.findSlnFile.outputs.solutionFilePath }}" --filter TestCategory!=IntegrationTest --logger "trx;logfilename=unitTestResults.trx" --collect "XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=cobertura,opencover
145-
continue-on-error: true
146-
147-
# - name: Install SonarCloud scanner
148-
# if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true'
149-
# run: |
150-
# dotnet tool install dotnet-sonarscanner --global
151-
152-
# - name: Prepare SonarCloud Variables
153-
# id: prepSonarCloudVar
154-
# if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true'
155-
# run: |
156-
# import os
157-
# env_file = os.getenv('GITHUB_ENV')
158-
# with open(env_file, "a") as myfile:
159-
# myfile.write("lowerCaseOwner=" + str.lower("${{ inputs.owner }}"))
160-
# shell: python
161-
162-
# - name: Get SonarCloud Status
163-
# id: get-sonarcloud-status
164-
# if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true'
165-
# run: |
166-
# echo "sonarCloudProjectStatus=$(curl https://${{ secrets.sonarCloudToken }}@sonarcloud.io/api/qualitygates/project_status?projectKey=${{ inputs.sonarCloudProjectName }})" >> $env:GITHUB_OUTPUT
167-
# continue-on-error: true
168-
169-
# - name: Trigger Initial Analysis
170-
# if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true' && fromJson(steps.get-sonarcloud-status.outputs.sonarCloudProjectStatus).projectStatus.status == 'NONE'
171-
# env:
172-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
173-
# SONAR_TOKEN: ${{ secrets.sonarCloudToken }}
174-
# run: |
175-
# dotnet sonarscanner begin /k:"${{ inputs.sonarCloudProjectName }}" /o:"${{ env.lowerCaseOwner }}" /d:sonar.token="${{ secrets.sonarCloudToken }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" /d:sonar.cs.vstest.reportsPaths="**/TestResults/**.trx"
176-
# dotnet build "${{ steps.findSlnFile.outputs.solutionFilePath }}" -p:DefineConstants="DCFv1%3BDBInfo%3BALARM_SQUASHING" --configuration Release -nodeReuse:false
177-
# dotnet sonarscanner end /d:sonar.token="${{ secrets.sonarCloudToken }}"
178-
# continue-on-error: true
179-
180-
# - name: Analyze
181-
# if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true'
182-
# env:
183-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
184-
# SONAR_TOKEN: ${{ secrets.sonarCloudToken }}
185-
# run: |
186-
# dotnet sonarscanner begin /k:"${{ inputs.sonarCloudProjectName }}" /o:"${{ env.lowerCaseOwner }}" /d:sonar.token="${{ secrets.sonarCloudToken }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" /d:sonar.cs.vstest.reportsPaths="**/TestResults/**.trx"
187-
# dotnet build "${{ steps.findSlnFile.outputs.solutionFilePath }}" -p:DefineConstants="DCFv1%3BDBInfo%3BALARM_SQUASHING" --configuration Release -nodeReuse:false
188-
# dotnet sonarscanner end /d:sonar.token="${{ secrets.sonarCloudToken }}"
189-
# continue-on-error: true
190-
191-
# - name: SonarCloud Quality Gate check
192-
# id: sonarcloud-quality-gate-check
193-
# if: steps.detectCsprojFiles.outputs.csproj-file-present == 'true'
194-
# uses: sonarsource/sonarqube-quality-gate-action@master
195-
# with:
196-
# scanMetadataReportFile: .sonarqube/out/.sonar/report-task.txt
197-
# continue-on-error: true
198-
# # Force to fail step after specific time.
199-
# timeout-minutes: 5
200-
# env:
201-
# SONAR_TOKEN: ${{ secrets.sonarCloudToken }}
202-
203-
- name: Quality Gate
204-
id: quality-step
205-
run: |
206-
if "${{ steps.detectCsprojFiles.outputs.csproj-file-present }}" == "false":
207-
print("Quality gate skipped as no .csproj files were detected.")
208-
exit(0)
209-
if "${{ steps.unit-tests.outcome }}" == "failure":
210-
print("Quality gate failed due to:")
211-
if "${{ steps.unit-tests.outcome }}" == "failure":
212-
print("- Test failures")
213-
if "${{ steps.unit-tests.outcome }}" == "failure":
214-
exit(1)
215-
shell: python
216-
21746
artifact_creation:
21847
name: Artifact Creation
21948
runs-on: ubuntu-latest
@@ -305,62 +134,4 @@ jobs:
305134
- uses: actions/upload-artifact@v4
306135
with:
307136
name: DataMiner Installation Package
308-
path: "${{ github.workspace }}/${{ steps.packageName.outputs.name }}.dmapp"
309-
310-
311-
artifact_creation_registration:
312-
name: Artifact Registration and Upload
313-
if: inputs.referenceType == 'tag'
314-
runs-on: ubuntu-latest
315-
needs: [validate_skyline_quality_gate,artifact_creation]
316-
env:
317-
result-artifact-id: none
318-
outputs:
319-
artifact-id: ${{ env.result-artifact-id }}
320-
steps:
321-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
322-
- uses: actions/checkout@v4
323-
with:
324-
fetch-depth: 0
325-
326-
- name: Find branch
327-
id: findBranch
328-
run: |
329-
#!/bin/bash
330-
set -e # Exit immediately if a command exits with a non-zero status.
331-
332-
# Capture the branches containing the tag and process them
333-
branches="$(git branch --contains tags/${{ inputs.referenceName }} -r | grep 'origin/' | grep -vE '.*/.*/' | sed 's#origin/##' | paste -sd ",")"
334-
335-
# Append to GitHub Actions output
336-
echo "branch=${branches}" >> $GITHUB_OUTPUT
337-
shell: bash
338-
339-
- name: Target Branch
340-
id: showResult
341-
run: echo "${{ steps.findBranch.outputs.branch }}"
342-
343-
- name: Retrieve Installation Package
344-
id: retrieveInstallationPackage
345-
uses: actions/download-artifact@v4
346-
with:
347-
name: DataMiner Installation Package
348-
path: _DataMinerInstallationPackage
349-
350-
- name: Find Installation package
351-
id: findInstallationPackage
352-
run: |
353-
IFS=$'\n'
354-
echo dmappPackageName=$(find _DataMinerInstallationPackage -type f -name '*.dmapp') >> $GITHUB_OUTPUT
355-
unset IFS
356-
shell: bash
357-
# - name: Install .NET Tools
358-
# run: |
359-
# dotnet tool install -g Skyline.DataMiner.CICD.Tools.CatalogUpload
360-
361-
# - name: Upload to Catalog
362-
# id: uploadToCatalog
363-
# run: echo "id=$(dataminer-catalog-upload with-registration --path-to-artifact "${{ steps.findInstallationPackage.outputs.dmappPackageName }}" --uri-sourcecode "${{ github.server_url }}/${{ github.repository }}" --artifact-version ${{ inputs.referenceName }} --branch "${{ steps.findBranch.outputs.branch }}" --dm-catalog-token ${{ secrets.api-key }})" >> $GITHUB_OUTPUT
364-
365-
# - name: (Release) Set artifact Id
366-
# run: echo "result-artifact-id=${{ steps.uploadToCatalog.outputs.id }}" >> $GITHUB_ENV
137+
path: "${{ github.workspace }}/${{ steps.packageName.outputs.name }}.dmapp"

.github/workflows/DataMiner+CI+Automation.yml

+9-5
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ jobs:
8181
path=$(find _DataMinerInstallationPackage -type f -name '*.dmapp')
8282
echo $path
8383
84-
newpath="${path%.*}_${{ github.ref_name }}.dmapp"
85-
echo $newpath
86-
87-
mv $path $newpath
88-
echo "dmappPackageName=$newpath" >> $GITHUB_OUTPUT
84+
if [ ! -z "$path"]
85+
then
86+
newpath="${path%.*}_${{ github.ref_name }}.dmapp"
87+
echo $newpath
88+
mv $path $newpath
89+
echo "dmappPackageName=$newpath" >> $GITHUB_OUTPUT
90+
else
91+
echo "dmappPackageName=""" >> $GITHUB_OUTPUT
92+
fi
8993
9094
- name: Logging
9195
run: |

0 commit comments

Comments
 (0)