Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change maven artifactId to sdk-android #235

Merged
merged 7 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,10 @@ jobs:
working-directory: languages/kotlin
run: ./build-schemas.sh

- name: Login to Azure - CI Subscription
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Retrieve bot secrets
id: retrieve-bot-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@8fccdaea2810d5dfb13753b6dd93bbd3a63ff82e
with:
keyvault: bitwarden-ci
secrets: "github-pat-bitwarden-devops-bot-packages-scope"

- name: Publish
uses: gradle/gradle-build-action@ef76a971e2fa3f867b617efd72f2fbd72cf6f8bc # v2.8.0
with:
arguments: sdk:publish
build-root-directory: languages/kotlin
env:
GITHUB_ACTOR: "bitwarden-devops-bot"
GITHUB_TOKEN: ${{ steps.retrieve-bot-secrets.outputs.github-pat-bitwarden-devops-bot-packages-scope }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Hinton marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion languages/kotlin/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

dependencies {
// implementation 'com.bitwarden.sdk'
// implementation 'com.bitwarden.sdk-android'
Hinton marked this conversation as resolved.
Show resolved Hide resolved
implementation project(':sdk')

implementation 'androidx.core:core-ktx:1.8.0'
Expand Down
24 changes: 17 additions & 7 deletions languages/kotlin/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'maven-publish'
id 'com.palantir.git-version' version '3.0.0'
}

android {
Expand Down Expand Up @@ -42,14 +41,25 @@ publishing {
publications {
maven(MavenPublication) {
groupId = 'com.bitwarden'
artifactId = 'sdk'
artifactId = 'sdk-android'

def details = versionDetails()
// Determine the version from the git history.
//
// PRs: use the branch name.
// Master: Grab it from `crates/bitwarden/Cargo.toml`
withinfocus marked this conversation as resolved.
Show resolved Hide resolved

if (details.branchName == null) {
version = "master-SNAPSHOT"
def branchName = "git branch --show-current".execute().text.trim()

if (branchName == null) {
def content = ['grep', '-o', '^version = ".*"', '../../crates/bitwarden/Cargo.toml'].execute().text.trim()
def match = ~/version = "(.*)"/
def matcher = match.matcher(content)
matcher.find()

version = "${matcher.group(1)}-SNAPSHOT"
} else {
version "${details.branchName.replaceAll('/', '-')}-SNAPSHOT"
// branchName-SNAPSHOT
version = "${branchName.replaceAll('/', '-')}-SNAPSHOT"
}

afterEvaluate {
Expand All @@ -60,7 +70,7 @@ publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/bitwarden/sdk-maven"
url = "https://maven.pkg.github.com/bitwarden/sdk"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
Expand Down