release action #38
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: 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: qsdqsd | |
# secrets: | |
# api-key: ${{ secrets.DATAMINER_DEPLOY_KEY }} | |
# sonarCloudToken: ${{ secrets.SONAR_TOKEN }} | |
Release: | |
# if: github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
# needs: CI | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Check Release | |
id: release_check | |
run: | | |
REF_NAME="${{ secrets.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_${{ secrets.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: Logging | |
run: | | |
echo ${{ steps.changelog_check.outputs.changelog_exists }} | |
echo ${{ steps.changelog_check.outputs.changelog_file }} | |
echo ${{ steps.release_check.outputs.prerelease }} | |
- name: Create Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body_path: ${{ steps.changelog_check.outputs.changelog_file }} | |
draft: false | |
prerelease: ${{ steps.release_check.outputs.prerelease == 'true' }} |