-
Notifications
You must be signed in to change notification settings - Fork 4
141 lines (126 loc) · 4.85 KB
/
dataminer-cicd-automation.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
139
140
141
name: DataMiner CICD Automation
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: []
tags:
- "[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:
CI:
uses: SkylineCommunications/_ReusableWorkflows/.github/workflows/Automation Master Workflow.yml@main
with:
referenceName: ${{ github.ref_name }}
runNumber: ${{ github.run_number }}
referenceType: ${{ github.ref_type }}
repository: ${{ github.repository }}
owner: ${{ github.repository_owner }}
sonarCloudProjectName: SkylineCommunications_Low-Code-App-Extensions
secrets:
# The API-key: generated in the DCP Admin app (https://admin.dataminer.services/) as authentication for a certain DataMiner System.
api-key: ${{ secrets.DATAMINER_DEPLOY_KEY }}
sonarCloudToken: ${{ secrets.SONAR_TOKEN }}
Release:
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: CI
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Check Release
id: release_check
run: |
REF_NAME="${{ github.ref_name }}"
RELEASE_REGEX="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$"
PRE_RELEASE_REGEX="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+-[0-9a-zA-Z]+$"
if [[ $REF_NAME =~ $RELEASE_REGEX ]]
then
echo "prerelease=false" >> $GITHUB_OUTPUT
echo "Release"
exit 0
elif [[ $REF_NAME =~ $PRE_RELEASE_REGEX ]]
then
echo "prerelease=true" >> $GITHUB_OUTPUT
echo "Pre-Release"
exit 0
else
echo "Tag is in the incorrect format. Should be 0.0.0.0 for a release or 0.0.0.0-someprereleasetag for a pre-release."
exit 1
fi
- name: Check Changelog
id: changelog_check
if: steps.release_check.outputs.prerelease == 'false'
run: |
FILE=./Documentation/CHANGELOG_${{ github.ref_name }}.md
echo "$FILE"
if [ -f "$FILE" ]
then
echo "changelog_exists=true" >> $GITHUB_OUTPUT
echo "changelog_file=$FILE" >> $GITHUB_OUTPUT
exit 0
else
echo "There is no changelog found for tag $FILE. Please add a CHANGELOG_$FILE.md file with the changes for this version in the Documentation folder."
exit 1
fi
- name: Retrieve Installation Package
id: retrieveInstallationPackage
uses: actions/download-artifact@v4
with:
name: DataMiner Installation Package
path: _DataMinerInstallationPackage
- name: Find Installation Package
id: findInstallationPackage
run: |
path=$(find _DataMinerInstallationPackage -type f -name '*.dmapp')
echo $path
if [ ! -z "$path" ]
then
newpath="${path%.*}_${{ github.ref_name }}.dmapp"
echo $newpath
mv $path $newpath
echo "dmappPackageName=$newpath" >> $GITHUB_OUTPUT
else
exit 1
echo "dmappPackageName=""" >> $GITHUB_OUTPUT
fi
- name: Logging
run: |
echo ${{ steps.changelog_check.outputs.changelog_exists }}
echo ${{ steps.changelog_check.outputs.changelog_file }}
echo ${{ steps.release_check.outputs.prerelease }}
echo ${{ steps.findInstallationPackage.outputs.dmappPackageName }}
- name: Create Release
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
with:
name: ${{ github.ref_name }}
bodyFile: ${{ steps.changelog_check.outputs.changelog_file }}
draft: false
prerelease: ${{ steps.release_check.outputs.prerelease == 'true' }}
allowUpdates: true
artifacts: ${{ steps.findInstallationPackage.outputs.dmappPackageName }}
# # Optional 0 or More CD Jobs as needed
# CD:
# if: github.ref_type == 'tag'
# environment: production
# name: CD
# runs-on: ubuntu-latest
# needs: CI
# steps:
# - uses: actions/checkout@v3
# - name: Skyline DataMiner Deploy Action
# uses: SkylineCommunications/Skyline-DataMiner-Deploy-Action@v1
# with:
# # Stage deploy
# stage: Deploy
# # The API-key: generated in the DCP Admin app (https://admin.dataminer.services/) as authentication for a certain DataMiner System.
# api-key: ${{ secrets.DATAMINER_DEPLOY_KEY }}
# # Id of the uploaded artifact
# artifact-id: ${{ needs.CI.outputs.artifact-id }}