Skip to content

Commit

Permalink
Merge pull request #196 from hannesa2/AutomaticChangelog
Browse files Browse the repository at this point in the history
Automatic changelog and versionName
  • Loading branch information
hannesa2 authored Jan 1, 2023
2 parents 02d679c + d9cb81b commit dcf9116
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 11 deletions.
16 changes: 16 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
changelog:
exclude:
labels:
- ignore-for-release
authors:
- someuser
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: Exciting New Features 🎉
labels:
- enhancement
- title: Other Changes
labels:
- "*"
23 changes: 14 additions & 9 deletions .github/workflows/Android-CI-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Find Tag
id: tagger
uses: jimschubert/query-tag-action@v2
with:
skip-unshallow: 'true'
abbrev: false
commit-ish: HEAD
- name: Install JDK ${{ matrix.java_version }}
uses: actions/setup-java@v3
with:
Expand All @@ -23,14 +30,12 @@ jobs:
uses: malinskiy/action-android/install-sdk@release/0.1.4
- name: Build project
run: ./gradlew assembleRelease
env:
VERSION: ${{ github.ref }}
- run: |
assetsAAR=$(find . -name *release.aar | while read -r asset ; do echo "-a $asset" ; done)
VERSION=$(echo $VERSION | cut -d'/' -f3)
assetsJAR=$(find . -name *${VERSION}.jar | while read -r asset ; do echo "-a $asset" ; done)
tag_name="${GITHUB_REF##*/}"
hub release create ${assetsAAR} ${assetsJAR} -m "$tag_name" "$tag_name"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{steps.tagger.outputs.tag}}
name: ${{steps.tagger.outputs.tag}}
generate_release_notes: true
files: ./library/build/outputs/aar/lib*-release.aar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
14 changes: 12 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.panoramagl.sample"
minSdkVersion 15
targetSdkVersion 33
versionCode 1
versionName "1.0"
versionCode getGitCommitCount()
versionName getTag()
}

buildFeatures {
Expand All @@ -35,3 +35,13 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.android.material:material:1.7.0'
}

static def getGitCommitCount() {
def process = "git rev-list HEAD --count".execute()
return process.text.toInteger()
}

static def getTag() {
def process = "git describe --tags".execute()
return process.text.toString().trim()
}

0 comments on commit dcf9116

Please sign in to comment.