generated from wednesday-solutions/react-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from wednesday-solutions/feat/commit-linters
alpha release commit linters
- Loading branch information
Showing
1 changed file
with
79 additions
and
0 deletions.
There are no files selected for viewing
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
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=" • $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 |