From 89ad721328e96fbaebb314862843fdb6b9472753 Mon Sep 17 00:00:00 2001 From: Matt Bishop Date: Thu, 14 Sep 2023 09:15:29 -0400 Subject: [PATCH] Versioning --- .github/workflows/build-android.yml | 20 +++++++++++++++++++- languages/kotlin/sdk/build.gradle | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml index 0ce608471..1ea45773c 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -13,6 +13,21 @@ defaults: shell: bash jobs: + setup: + name: Setup + runs-on: ubuntu-22.04 + outputs: + package_version: ${{ steps.retrieve-version.outputs.package_version }} + steps: + - name: Checkout repo + uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 + + - name: Get Package Version + id: retrieve-version + run: | + VERSION=$(grep -o '^version = ".*"' crates/bws/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") + echo "package_version=$VERSION" >> $GITHUB_OUTPUT + build: runs-on: ubuntu-22.04 strategy: @@ -54,7 +69,9 @@ jobs: combine: runs-on: ubuntu-22.04 - needs: build + needs: + - setup + - build steps: - name: Checkout repo (PR) uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0 @@ -119,5 +136,6 @@ jobs: arguments: sdk:publish build-root-directory: languages/kotlin env: + _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} GITHUB_ACTOR: "bitwarden-devops-bot" GITHUB_TOKEN: ${{ steps.retrieve-bot-secrets.outputs.github-pat-bitwarden-devops-bot-packages-scope }} diff --git a/languages/kotlin/sdk/build.gradle b/languages/kotlin/sdk/build.gradle index 6436eb1c4..bd3a035f8 100644 --- a/languages/kotlin/sdk/build.gradle +++ b/languages/kotlin/sdk/build.gradle @@ -47,9 +47,9 @@ publishing { def details = versionDetails() if (details.branchName == null) { - version = "master-SNAPSHOT" + version = System.getenv("_PACKAGE_VERSION") } else { - version "${details.branchName.replaceAll('/', '-')}-SNAPSHOT" + version "${System.getenv("_PACKAGE_VERSION")}-${details.branchName.replaceAll('/', '-')}-SNAPSHOT" } afterEvaluate {