From 251987685c8768cbe98fd5c6a42f06eedff4f27e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Sep 2023 12:33:37 +0200 Subject: [PATCH 1/3] Update dtolnay/rust-toolchain digest to 439cf60 (#239) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/build-android.yml | 4 ++-- .github/workflows/build-cli.yml | 4 ++-- .github/workflows/build-napi.yml | 2 +- .github/workflows/build-rust-crates.yml | 4 ++-- .github/workflows/direct-minimal-versions.yml | 2 +- .github/workflows/generate_schemas.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/publish-rust-crates.yml | 2 +- .github/workflows/release-cli.yml | 2 +- .github/workflows/rust-test.yml | 4 ++-- .github/workflows/version-bump.yml | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index c5e3f1fee..f723859a6 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -28,7 +28,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: 1.67.0 # https://github.com/cross-rs/cross/issues/1222 @@ -70,7 +70,7 @@ jobs: fetch-depth: 0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 0d79e9831..3a0ab6213 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -63,7 +63,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable targets: ${{ matrix.settings.target }} @@ -158,7 +158,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml index a571a9ed2..e9a8f49a5 100644 --- a/.github/workflows/build-napi.yml +++ b/.github/workflows/build-napi.yml @@ -61,7 +61,7 @@ jobs: cache-dependency-path: crates/bitwarden-napi/package-lock.json - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable targets: ${{ matrix.settings.target }} diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index 08b745069..c7d5aaf85 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable targets: ${{ matrix.settings.target }} @@ -67,7 +67,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable targets: ${{ matrix.settings.target }} diff --git a/.github/workflows/direct-minimal-versions.yml b/.github/workflows/direct-minimal-versions.yml index ce5d8f525..41a5e4b68 100644 --- a/.github/workflows/direct-minimal-versions.yml +++ b/.github/workflows/direct-minimal-versions.yml @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: nightly targets: ${{ matrix.settings.target }} diff --git a/.github/workflows/generate_schemas.yml b/.github/workflows/generate_schemas.yml index cc5f5c9e5..1f75ee483 100644 --- a/.github/workflows/generate_schemas.yml +++ b/.github/workflows/generate_schemas.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 735b6e95f..03f4fb4e0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,7 +20,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable diff --git a/.github/workflows/publish-rust-crates.yml b/.github/workflows/publish-rust-crates.yml index c38e2822a..7ba18cc57 100644 --- a/.github/workflows/publish-rust-crates.yml +++ b/.github/workflows/publish-rust-crates.yml @@ -115,7 +115,7 @@ jobs: secrets: "cratesio-api-token" - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index d393b9d22..d80fc1f7a 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -140,7 +140,7 @@ jobs: secrets: "cratesio-api-token" - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index d92a54ba5..877cbbbc0 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable @@ -59,7 +59,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable targets: wasm32-unknown-unknown diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index e7421bde6..0944f969a 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -32,7 +32,7 @@ jobs: uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 - name: Install rust - uses: dtolnay/rust-toolchain@5cb429dd810e16ff67df78472fa81cf760f4d1c0 # stable + uses: dtolnay/rust-toolchain@439cf607258077187679211f12aa6f19af4a0af7 # stable with: toolchain: stable From 0185899f1479a945d4df6b74784e701071ad58d2 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 21 Sep 2023 16:33:20 +0200 Subject: [PATCH 2/3] Change maven artifactId to sdk-android (#235) * Remove github_actor * Use custom git commands instead * Grab from cargo file instead * Add workflow for cleaning up old packages * Only specify min-versions-to-keep * Update name --------- Co-authored-by: Matt Bishop --- .github/workflows/build-android.yml | 15 +------------- .github/workflows/delete-old-packages.yml | 25 +++++++++++++++++++++++ languages/kotlin/app/build.gradle | 2 +- languages/kotlin/sdk/build.gradle | 24 +++++++++++++++------- 4 files changed, 44 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/delete-old-packages.yml diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index f723859a6..579392c8e 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -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 }} diff --git a/.github/workflows/delete-old-packages.yml b/.github/workflows/delete-old-packages.yml new file mode 100644 index 000000000..517560ede --- /dev/null +++ b/.github/workflows/delete-old-packages.yml @@ -0,0 +1,25 @@ +--- +name: Delete old packages + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +defaults: + run: + shell: bash + +jobs: + delete: + name: Cleanup Android SDK + runs-on: ubuntu-22.04 + steps: + - uses: actions/delete-package-versions@0d39a63126868f5eefaa47169615edd3c0f61e20 # v4.1.1 + with: + package-name: com.bitwarden.sdk-android + package-type: maven + min-versions-to-keep: 25 + + # Ignore versions only containing version numbers + ignore-versions: '^\\d*\\.\\d*\\.\\d*$' diff --git a/languages/kotlin/app/build.gradle b/languages/kotlin/app/build.gradle index 2b7bc0255..709e32889 100644 --- a/languages/kotlin/app/build.gradle +++ b/languages/kotlin/app/build.gradle @@ -48,7 +48,7 @@ android { } dependencies { - // implementation 'com.bitwarden.sdk' + // implementation 'com.bitwarden.sdk-android' implementation project(':sdk') implementation 'androidx.core:core-ktx:1.8.0' diff --git a/languages/kotlin/sdk/build.gradle b/languages/kotlin/sdk/build.gradle index 3d164e094..5b8637f83 100644 --- a/languages/kotlin/sdk/build.gradle +++ b/languages/kotlin/sdk/build.gradle @@ -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 { @@ -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` - 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 { @@ -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") From 58dbf9b6da32a0dea1a68c09b5282dc654b0d6ef Mon Sep 17 00:00:00 2001 From: Matt Bishop Date: Thu, 21 Sep 2023 13:28:12 -0400 Subject: [PATCH 3/3] Check for master branch with Maven builds (#246) --- languages/kotlin/sdk/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/kotlin/sdk/build.gradle b/languages/kotlin/sdk/build.gradle index 5b8637f83..3fb6956e2 100644 --- a/languages/kotlin/sdk/build.gradle +++ b/languages/kotlin/sdk/build.gradle @@ -50,7 +50,7 @@ publishing { def branchName = "git branch --show-current".execute().text.trim() - if (branchName == null) { + if (branchName == "master") { def content = ['grep', '-o', '^version = ".*"', '../../crates/bitwarden/Cargo.toml'].execute().text.trim() def match = ~/version = "(.*)"/ def matcher = match.matcher(content)