Added a new step to automatically create a github release on tag. #68
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |