Use latest tag for version name (#2251)

This commit is contained in:
LoveSy 2022-11-29 22:05:22 +08:00 committed by GitHub
parent 6b70b624e3
commit fd1c51e027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 12 deletions

View File

@ -4,6 +4,7 @@ on:
workflow_dispatch:
push:
branches: [ master ]
tags: [ v* ]
pull_request:
jobs:
@ -21,7 +22,7 @@ jobs:
submodules: 'recursive'
fetch-depth: 0
- name: Write key
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
if: ${{ ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' }}
run: |
if [ ! -z "${{ secrets.KEY_STORE }}" ]; then
echo androidStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
@ -109,7 +110,7 @@ jobs:
daemon/build/symbols
dex2oat/build/symbols
- name: Post to channel
if: ${{ github.event_name != 'pull_request' && success() && github.ref == 'refs/heads/master' }}
if: ${{ success() && ( ( github.event_name != 'pull_request' && github.ref == 'refs/heads/master' ) || github.ref_type == 'tag' ) }}
env:
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
DISCUSSION_ID: ${{ secrets.DISCUSSION_ID }}

View File

@ -21,7 +21,7 @@ import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.gradle.BaseExtension
import org.eclipse.jgit.api.Git
import org.eclipse.jgit.internal.storage.file.FileRepository
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import java.nio.file.Paths
import org.gradle.internal.os.OperatingSystem
@ -39,18 +39,28 @@ buildscript {
classpath("org.eclipse.jgit:org.eclipse.jgit:6.3.0.202209071007-r")
}
}
val repo = FileRepository(rootProject.file(".git"))
val refId = repo.refDatabase.exactRef("refs/remotes/origin/master").objectId!!
val commitCount = Git(repo).log().add(refId).call().count()
val (commitCount, latestTag) = FileRepositoryBuilder().setGitDir(rootProject.file(".git"))
.runCatching {
build().use { repo ->
val git = Git(repo)
val commitCount =
git.log()
.add(repo.refDatabase.exactRef("refs/remotes/origin/master").objectId)
.call().count() + 4200
val ver = git.describe()
.setTags(true)
.setAbbrev(0).call().removePrefix("v")
commitCount to ver
}
}.getOrNull() ?: (1 to "1.0")
val injectedPackageName by extra("com.android.shell")
val injectedPackageUid by extra(2000)
val defaultManagerPackageName by extra("org.lsposed.manager")
val apiCode by extra(93)
val verCode by extra(commitCount + 4200)
val verName by extra("1.8.5")
val verCode by extra(commitCount)
val verName by extra(latestTag)
val androidTargetSdkVersion by extra(33)
val androidMinSdkVersion by extra(27)
val androidBuildToolsVersion by extra("33.0.1")

2
external/dobby vendored

@ -1 +1 @@
Subproject commit a79d029bb2fd84a64a3fce87b813c222958725b7
Subproject commit f652f0c2a181c27808b6170acabe99af0e4291b1

2
external/lsplant vendored

@ -1 +1 @@
Subproject commit a15d854930c46e4da35832c2140a5abbc794d405
Subproject commit 65a276ff917fe2c4ab4be95d25ed9084e34f98c8

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists