|
28 | 28 | # The API-key: generated in the DCP Admin app (https://admin.dataminer.services/) as authentication for a certain DataMiner System.
|
29 | 29 | api-key: ${{ secrets.DATAMINER_DEPLOY_KEY }}
|
30 | 30 | sonarCloudToken: ${{ secrets.SONAR_TOKEN }}
|
31 |
| - |
| 31 | + |
| 32 | + Release: |
| 33 | + if: github.ref_type == 'tag' |
| 34 | + runs-on: ubuntu-latest |
| 35 | + needs: CI |
| 36 | + permissions: |
| 37 | + contents: write |
| 38 | + steps: |
| 39 | + - name: Checkout Code |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Check Release |
| 43 | + id: release_check |
| 44 | + run: | |
| 45 | + REF_NAME="${{ github.ref_name }}" |
| 46 | + RELEASE_REGEX="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$" |
| 47 | + PRE_RELEASE_REGEX="^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+-[0-9a-zA-Z]+$" |
| 48 | + if [[ $REF_NAME =~ $RELEASE_REGEX ]] |
| 49 | + then |
| 50 | + echo "prerelease=false" >> $GITHUB_OUTPUT |
| 51 | + echo "Release" |
| 52 | + exit 0 |
| 53 | + elif [[ $REF_NAME =~ $PRE_RELEASE_REGEX ]] |
| 54 | + then |
| 55 | + echo "prerelease=true" >> $GITHUB_OUTPUT |
| 56 | + echo "Pre-Release" |
| 57 | + exit 0 |
| 58 | + else |
| 59 | + 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." |
| 60 | + exit 1 |
| 61 | + fi |
| 62 | +
|
| 63 | + - name: Check Changelog |
| 64 | + id: changelog_check |
| 65 | + if: steps.release_check.outputs.prerelease == 'false' |
| 66 | + run: | |
| 67 | + FILE=./Documentation/CHANGELOG_${{ github.ref_name }}.md |
| 68 | + echo "$FILE" |
| 69 | + if [ -f "$FILE" ] |
| 70 | + then |
| 71 | + echo "changelog_exists=true" >> $GITHUB_OUTPUT |
| 72 | + echo "changelog_file=$FILE" >> $GITHUB_OUTPUT |
| 73 | + exit 0 |
| 74 | + else |
| 75 | + 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." |
| 76 | + exit 1 |
| 77 | + fi |
| 78 | +
|
| 79 | + - name: Retrieve Installation Package |
| 80 | + id: retrieveInstallationPackage |
| 81 | + uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + name: DataMiner Installation Package |
| 84 | + path: _DataMinerInstallationPackage |
| 85 | + |
| 86 | + - name: Find Installation Package |
| 87 | + id: findInstallationPackage |
| 88 | + run: | |
| 89 | + path=$(find _DataMinerInstallationPackage -type f -name '*.dmapp') |
| 90 | + echo $path |
| 91 | +
|
| 92 | + if [ ! -z "$path" ] |
| 93 | + then |
| 94 | + newpath="${path%.*}_${{ github.ref_name }}.dmapp" |
| 95 | + echo $newpath |
| 96 | + mv $path $newpath |
| 97 | + echo "dmappPackageName=$newpath" >> $GITHUB_OUTPUT |
| 98 | + else |
| 99 | + exit 1 |
| 100 | + echo "dmappPackageName=""" >> $GITHUB_OUTPUT |
| 101 | + fi |
| 102 | +
|
| 103 | + - name: Logging |
| 104 | + run: | |
| 105 | + echo ${{ steps.changelog_check.outputs.changelog_exists }} |
| 106 | + echo ${{ steps.changelog_check.outputs.changelog_file }} |
| 107 | + echo ${{ steps.release_check.outputs.prerelease }} |
| 108 | + echo ${{ steps.findInstallationPackage.outputs.dmappPackageName }} |
| 109 | +
|
| 110 | + - name: Create Release |
| 111 | + uses: ncipollo/release-action@v1 |
| 112 | + env: |
| 113 | + GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} |
| 114 | + with: |
| 115 | + name: ${{ github.ref_name }} |
| 116 | + bodyFile: ${{ steps.changelog_check.outputs.changelog_file }} |
| 117 | + draft: false |
| 118 | + prerelease: ${{ steps.release_check.outputs.prerelease == 'true' }} |
| 119 | + allowUpdates: true |
| 120 | + artifacts: ${{ steps.findInstallationPackage.outputs.dmappPackageName }} |
| 121 | + |
32 | 122 | # # Optional 0 or More CD Jobs as needed
|
33 | 123 | # CD:
|
34 | 124 | # if: github.ref_type == 'tag'
|
|
0 commit comments