Skip to content

Commit

Permalink
Merge pull request #17 from wednesday-solutions/feat/commit-linters
Browse files Browse the repository at this point in the history
alpha release commit linters
  • Loading branch information
Anurag-Wednesday authored Apr 6, 2022
2 parents 0134b11 + 22259fc commit 870c11f
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/alpha-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
on:
push:
branches:
- master

name: Create Alpha Release

jobs:
build:
name: Create Alpha Release
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, 'release aplha') || contains(github.event.head_commit.message, 'alpha release')"
steps:
- name: Actions Ecosystem Action Get Merged Pull Request
uses: actions-ecosystem/[email protected]
id: getMergedPR
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow --tags
- name: Get Commit Message
run: |
declare -A category=( [fix]="" [revert]="" [build]="" [docs]="" [feature]="" [performance]="" [refactor]="" [style]="" [test]="" [others]="")
declare -A categoryTitle=( [fix]="<h5>Bug Fixes</h5>" [build]="<h5>Build</h5>" [docs]="<h5>Documentation</h5>" [feature]="<h5>New Features</h5>" [performance]="<h5>Performance Enhancement</h5>" [revert]="<h5>Revert Commits</h5>" [refactor]="<h5>Refactored</h5>" [style]="<h5>Changed Style</h5>" [test]="<h5>Added Tests</h5>" [others]="<h5>Others</h5>")
msg="#${{ steps.getMergedPR.outputs.number}} ${{ steps.getMergedPR.outputs.title}}"
for i in $(git log --format=%h $(git merge-base HEAD^1 HEAD^2)..HEAD^2)
do
IFS=":" read -r type cmmsg <<< $(git log --format=%B -n 1 $i)
type="${type}" | xargs
text_msg="&nbsp;&nbsp;&nbsp;&nbsp;&#8226; $i - ${cmmsg}<br/>"
flag=1
for i in "${!category[@]}"
do
if [ "${type}" == "$i" ]
then
category[$i]+="${text_msg}"
flag=0
break
fi
done
if [ $flag -eq 1 ]
then
category[others]+="${text_msg}"
fi
done
for i in "${!category[@]}"
do
if [ ! -z "${category[$i]}" ] && [ "others" != "$i" ]
then
msg+="${categoryTitle[$i]}${category[$i]}"
fi
done
# if [ ! -z "${category[others]}" ]
# then
# msg+="${categoryTitle[others]}${category[others]}"
# fi
echo "COMMIT_MESSAGE=${msg}" >> $GITHUB_ENV
- name: Bump version and push tag
run: |
cd "$GITHUB_WORKSPACE"
git config user.email "[email protected]"
git config user.name "$GITHUB_ACTOR"
npm version patch
git push && git push --tags
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@master
- name: Create Alpha Release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.package-version.outputs.current-version}}-alpha
release_name: v${{ steps.package-version.outputs.current-version}}-alpha
body: ${{ env.COMMIT_MESSAGE }}
draft: false
prerelease: false

0 comments on commit 870c11f

Please sign in to comment.