Skip to content

Commit

Permalink
fix: CD for android apk
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-wedensday committed Apr 18, 2024
1 parent a4822b2 commit 9889ec9
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build and Release Android App
on:
push:
branches:
- master
- feat/cd-workflow
tags:
- v*
permissions:
Expand Down Expand Up @@ -41,8 +41,34 @@ jobs:
- name: Set tag name
id: set_tag_name
run: |
TAG_NAME="v$(date +'%Y%m%d')-${GITHUB_SHA::8}"
echo "::set-output name=tag_name::$TAG_NAME"
# Determine the latest tag and commit messages since that tag
LAST_TAG=$(git describe --tags --abbrev=0)
COMMITS=$(git log --oneline ${LAST_TAG}..HEAD --format="%s")
# Initialize version components
MAJOR=0
MINOR=0
PATCH=0
# Analyze commit messages to determine version bump
while read -r line; do
if [[ "$line" == feat:* ]]; then
# Increment minor version for feature commits
((MINOR++))
elif [[ "$line" == chore:* ]]; then
# Increment major version for chore commits
((MAJOR++))
MINOR=0 # Reset minor version
elif [[ "$line" == fix:* ]]; then
# Increment patch version for fix commits
((PATCH++))
fi
done <<< "$COMMITS"
# Determine the next version based on commit analysis
NEXT_VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "::set-output name=next_version::$NEXT_VERSION"
- name: Upload Release APK
uses: actions/upload-artifact@v2
Expand All @@ -56,8 +82,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.set_tag_name.outputs.tag_name }}
release_name: Release ${{ github.ref }}
tag_name: ${{ steps.set_tag_name.outputs.next_version }}
release_name: Release ${{ steps.set_tag_name.outputs.next_version }}
draft: false
prerelease: false

Expand Down

0 comments on commit 9889ec9

Please sign in to comment.