Skip to content

Commit

Permalink
Merge pull request #62 from nielsvanvelzen/versiontags
Browse files Browse the repository at this point in the history
Use git tag as version for publishing
  • Loading branch information
Maxr1998 authored Aug 25, 2020
2 parents f9f80a4 + 907e982 commit 81a1f4a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
18 changes: 11 additions & 7 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
vmImage: 'ubuntu-latest'

steps:
- script: 'echo "##vso[task.setvariable variable=JELLYFIN_VERSION]$(git describe --tags)"'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
displayName: 'Set Version Variable'

- task: Gradle@2
displayName: 'Build Debug'
inputs:
Expand Down Expand Up @@ -86,8 +90,8 @@ jobs:
vmImage: 'ubuntu-latest'

steps:
- script: 'echo "##vso[task.setvariable variable=TAG]$(git describe --tags)"'
displayName: 'Set Tag Variable'
- script: 'echo "##vso[task.setvariable variable=JELLYFIN_VERSION]$(git describe --tags)"'
displayName: 'Set Version Variable'

- task: DownloadPipelineArtifact@2
displayName: 'Download APKs'
Expand All @@ -103,7 +107,7 @@ jobs:
inputs:
secureFile: 'keystore'

- script: '$(find / -name apksigner -print -quit) sign --ks ${KEYSTORE_SECUREFILEPATH} --ks-pass pass:${PASSWORD} --out ${SYSTEM_ARTIFACTSDIRECTORY}/jellyfin-android-${TAG}-release.apk ${SYSTEM_ARTIFACTSDIRECTORY}/jellyfin-android-${TAG}-release-unsigned.apk'
- script: '$(find / -name apksigner -print -quit) sign --ks ${KEYSTORE_SECUREFILEPATH} --ks-pass pass:${PASSWORD} --out ${SYSTEM_ARTIFACTSDIRECTORY}/jellyfin-android-${JELLYFIN_VERSION}-release.apk ${SYSTEM_ARTIFACTSDIRECTORY}/jellyfin-android-${JELLYFIN_VERSION}-release-unsigned.apk'
displayName: 'Sign Release APK'
env:
PASSWORD: $(KeyStorePassword)
Expand All @@ -112,7 +116,7 @@ jobs:
displayName: 'Remove Unsigned APK'
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: 'jellyfin-android-${TAG}-release-unsigned.apk'
contents: 'jellyfin-android-${JELLYFIN_VERSION}-release-unsigned.apk'

- task: GithubRelease@0
displayName: 'GitHub Upload'
Expand All @@ -122,17 +126,17 @@ jobs:
assets: '$(System.ArtifactsDirectory)/*.apk'
action: 'edit'
assetUploadMode: 'replace'
tag: '$(TAG)'
tag: '$(JELLYFIN_VERSION)'

- task: CopyFilesOverSSH@0
inputs:
sshEndpoint: repository
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**'
targetFolder: '/srv/repository/releases/client/android/versions/$(TAG)'
targetFolder: '/srv/repository/releases/client/android/versions/$(JELLYFIN_VERSION)'

- task: SSH@0
inputs:
sshEndpoint: repository
runOptions: 'inline'
inline: 'cd /srv/repository/releases/client/android && rm -rf *.apk && ln -s versions/$(TAG)/jellyfin-android-$(TAG)-*.apk .'
inline: 'cd /srv/repository/releases/client/android && rm -rf *.apk && ln -s versions/$(JELLYFIN_VERSION)/jellyfin-android-$(JELLYFIN_VERSION)-*.apk .'
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
applicationId = "org.jellyfin.mobile"
minSdkVersion(21)
targetSdkVersion(30)
versionName = "2.0.0-rc.2"
versionName = project.getVersionName()
versionCode = getVersionCode(versionName)
setProperty("archivesBaseName", "jellyfin-android-v$versionName")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
7 changes: 7 additions & 0 deletions buildSrc/src/main/kotlin/VersionUtils.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import org.gradle.api.Project

fun Project.getVersionName(): String? =
findProperty("jellyfin.version")?.toString()
?: System.getenv("JELLYFIN_VERSION")
?: "0.0.0-dev.1"

/**
* Get the version code for a given semantic version.
* Does not validate the input and thus will throw an exception when parts are missing.
Expand Down

0 comments on commit 81a1f4a

Please sign in to comment.