-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (103 loc) · 3.76 KB
/
DataMiner+CI+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
name: DataMiner CI Automation
on:
push:
branches: []
tags:
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+.[0-9]+-[0-9a-zA-Z]+'
workflow_dispatch:
jobs:
CI:
name: CI
uses: ./.github/workflows/Automation Master SDK Workflow.yml
with:
referenceName: ${{ github.ref_name }}
runNumber: ${{ github.run_number }}
referenceType: ${{ github.ref_type }}
repository: ${{ github.repository }}
owner: ${{ github.repository_owner }}
sonarCloudProjectName: qsdqsd
secrets:
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
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 }}