release action #50
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 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 }} |