-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataminer-cicd-automation-deployonly.yml
More file actions
87 lines (72 loc) · 3.84 KB
/
Copy pathdataminer-cicd-automation-deployonly.yml
File metadata and controls
87 lines (72 loc) · 3.84 KB
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
name: DataMiner DeployOnly Automation
# Prerequisite: secret 'DATAMINER_DEPLOY_KEY' necessary on Repository or Organization level.
# Value is the API-key generated in the DCP Admin app (https://admin.dataminer.services/) as authentication for a certain DataMiner System.
# Controls when the workflow will run
on:
push:
branches: []
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-**"
- "[0-9]+.[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+.[0-9]+-**"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
CD:
name: CD
environment: staging
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Find .sln file
id: findSlnFile
run: |
echo solutionFilePath=$(find . -type f -name '*.sln') >> $GITHUB_OUTPUT
shell: bash
- name: Find or create NuGet.config file
if: ${{ github.repository_owner }} == 'SkylineCommunications'
id: findOrCreateNuGetFile
run: |
file=$(find . -type f -iname 'nuget.config' | head -n 1)
if [[ -n "$file" ]]; then
echo "NuGet config file exists: $file"
echo NuGetFileName=$(basename $file) >> $GITHUB_OUTPUT
else
echo "NuGet config does not exist. Creating..."
dotnet new nugetconfig --output ${{ github.workspace }}
echo NuGetFileName=nuget.config >> $GITHUB_OUTPUT
fi
shell: bash
- name: Enable Skyline GitHub NuGet Registry
if: ${{ github.repository_owner }} == 'SkylineCommunications'
run: dotnet nuget add source "https://nuget.pkg.github.com/SkylineCommunications/index.json" --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --configfile ${{ github.workspace }}/${{ steps.findOrCreateNuGetFile.outputs.NuGetFileName }}
- 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
dotnet tool install -g Skyline.DataMiner.CICD.Tools.CatalogUpload
dotnet tool install -g Skyline.DataMiner.CICD.Tools.DataMinerDeploy
- name: Create package name
id: packageName
run: |
if [[ ${{ github.ref_type }} == 'branch' ]]; then
tempName="${{ github.repository }} ${{ github.ref_name }}_B${{ github.run_number }}"
else
tempName="${{ github.repository }} ${{ github.ref_name }}"
fi
echo name=${tempName//[\"\/\\<>|:*?]/_} >> $GITHUB_OUTPUT
shell: bash
- name: Create dmapp package (Development)
if: github.ref_type == 'branch'
run: dataminer-package-create dmapp "${{ github.workspace }}" --type automation --build-number ${{ github.run_number }} --output "${{ github.workspace }}" --name "${{ steps.packageName.outputs.name }}"
- name: Create dmapp package (Release)
if: github.ref_type == 'tag'
run: dataminer-package-create dmapp "${{ github.workspace }}" --type automation --version ${{ github.ref_name }} --output "${{ github.workspace }}" --name "${{ steps.packageName.outputs.name }}"
- name: Upload to Catalog
id: uploadToCatalog
run: echo "id=$(dataminer-catalog-upload --path-to-artifact "${{ github.workspace }}/${{ steps.packageName.outputs.name }}.dmapp" --dm-catalog-token "${{ secrets.DATAMINER_DEPLOY_KEY }}")" >> $GITHUB_OUTPUT
- name: Deploy to DataMiner
run: dataminer-package-deploy from-catalog --artifact-id "${{ steps.uploadToCatalog.outputs.id }}" --dm-catalog-token ${{ secrets.DATAMINER_DEPLOY_KEY }}