From cf1c05527f32c78c8fcc43ecdd231420474b3255 Mon Sep 17 00:00:00 2001 From: jakubdziworski Date: Thu, 3 Jul 2025 12:53:30 +0200 Subject: [PATCH 1/4] feat(FC-1287) Added GA integration with automatic publishing --- .github/workflows/main-pipeline.yml | 16 ++++++++++++++++ .github/workflows/pr-pipeline.yml | 16 ++++++++++++++++ build.gradle | 1 - scripts/publish_lib.sh | 9 +++++++++ scripts/version.sh | 15 +++++++++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main-pipeline.yml create mode 100644 .github/workflows/pr-pipeline.yml create mode 100644 scripts/publish_lib.sh create mode 100755 scripts/version.sh diff --git a/.github/workflows/main-pipeline.yml b/.github/workflows/main-pipeline.yml new file mode 100644 index 0000000..8bd552e --- /dev/null +++ b/.github/workflows/main-pipeline.yml @@ -0,0 +1,16 @@ +name: main pipeline + +on: + push: + branches: + - 'master' +jobs: + test_libraries: + uses: blockchain/devx-workflows/.github/workflows/library-pipeline.yml@0.0.35 + with: + version_script: scripts/version.sh + library_script: scripts/publish_lib.sh + build_docker_image: eu.gcr.io/blockchain-internal/build_common_jvm8-v2 + secrets: + nexus_password: ${{ secrets.NEXUS_PASSWORD }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/pr-pipeline.yml b/.github/workflows/pr-pipeline.yml new file mode 100644 index 0000000..0d1e16c --- /dev/null +++ b/.github/workflows/pr-pipeline.yml @@ -0,0 +1,16 @@ +name: pr pipeline + +on: + pull_request: + types: [ opened, synchronize, reopened ] + +jobs: + test_libraries: + uses: blockchain/devx-workflows/.github/workflows/library-pipeline.yml@0.0.35 + with: + version_script: scripts/version.sh + library_script: scripts/publish_lib.sh + build_docker_image: eu.gcr.io/blockchain-internal/build_common_jvm8-v2 + secrets: + nexus_password: ${{ secrets.NEXUS_PASSWORD }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index af82ca5..aba8875 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,5 @@ allprojects { group = 'com.blockchain.btcd-cli4j' - version = '0.5.8.15' } subprojects { diff --git a/scripts/publish_lib.sh b/scripts/publish_lib.sh new file mode 100644 index 0000000..26aa565 --- /dev/null +++ b/scripts/publish_lib.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +echo "nexusUrl=https://nexus.internal.blockchain.info" >> gradle.properties +echo "nexusUsername=github-actions" >> gradle.properties +echo "nexusPassword=$NEXUS_PASSWORD" >> gradle.properties +echo "gradleCachePassword=" >> gradle.properties + +chown -R blockchain:blockchain $PWD +su blockchain -c "./gradlew publish --no-daemon -Pversion=$VERSION" || true \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100755 index 0000000..09b46d4 --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +BUILD_VERSION=0.5.8 +if [ "$GITHUB_REF" = "refs/heads/master" ] + then + LAST_VERSION=$(git tag --sort=-v:refname --merged | grep -E '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n1) + echo "$LAST_VERSION" | grep -Ev '^$' > /dev/null || exit 1 + if [[ "$LAST_VERSION" == ${BUILD_VERSION}.* ]] + then BUILD_NUM=$(( 1 + $( cut -d. -f4 <<< "${LAST_VERSION}") )) + else BUILD_NUM=0 + fi + echo "${BUILD_VERSION}.${BUILD_NUM}" + else + GIT_COMMIT=$( git rev-parse --short HEAD ) + echo "$GITHUB_HEAD_REF"-"$GIT_COMMIT" +fi \ No newline at end of file From 82a4a96c80dc4e53338bf2671126434cbb24da1b Mon Sep 17 00:00:00 2001 From: Jakub Dziworski <94838237+jdziworski-bc@users.noreply.github.com> Date: Wed, 4 Feb 2026 10:42:14 +0100 Subject: [PATCH 2/4] Update library pipeline version to v1 --- .github/workflows/main-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-pipeline.yml b/.github/workflows/main-pipeline.yml index 8bd552e..2356c2f 100644 --- a/.github/workflows/main-pipeline.yml +++ b/.github/workflows/main-pipeline.yml @@ -6,11 +6,11 @@ on: - 'master' jobs: test_libraries: - uses: blockchain/devx-workflows/.github/workflows/library-pipeline.yml@0.0.35 + uses: blockchain/devx-workflows/.github/workflows/library-pipeline.yml@v1 with: version_script: scripts/version.sh library_script: scripts/publish_lib.sh build_docker_image: eu.gcr.io/blockchain-internal/build_common_jvm8-v2 secrets: nexus_password: ${{ secrets.NEXUS_PASSWORD }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e4cb4e82d65a36ee6534b050e4c02a1206955d59 Mon Sep 17 00:00:00 2001 From: Jakub Dziworski <94838237+jdziworski-bc@users.noreply.github.com> Date: Wed, 4 Feb 2026 10:42:29 +0100 Subject: [PATCH 3/4] Update library pipeline version to v1 --- .github/workflows/pr-pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-pipeline.yml b/.github/workflows/pr-pipeline.yml index 0d1e16c..0f38408 100644 --- a/.github/workflows/pr-pipeline.yml +++ b/.github/workflows/pr-pipeline.yml @@ -6,11 +6,11 @@ on: jobs: test_libraries: - uses: blockchain/devx-workflows/.github/workflows/library-pipeline.yml@0.0.35 + uses: blockchain/devx-workflows/.github/workflows/library-pipeline.yml@v1 with: version_script: scripts/version.sh library_script: scripts/publish_lib.sh build_docker_image: eu.gcr.io/blockchain-internal/build_common_jvm8-v2 secrets: nexus_password: ${{ secrets.NEXUS_PASSWORD }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f7c1e73d353cb41f0d07ce5433be84cfd3bd8eea Mon Sep 17 00:00:00 2001 From: Jakub Dziworski <94838237+jdziworski-bc@users.noreply.github.com> Date: Wed, 4 Feb 2026 10:44:10 +0100 Subject: [PATCH 4/4] Fix newline at end of publish_lib.sh --- scripts/publish_lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish_lib.sh b/scripts/publish_lib.sh index 26aa565..dd17969 100644 --- a/scripts/publish_lib.sh +++ b/scripts/publish_lib.sh @@ -6,4 +6,4 @@ echo "nexusPassword=$NEXUS_PASSWORD" >> gradle.properties echo "gradleCachePassword=" >> gradle.properties chown -R blockchain:blockchain $PWD -su blockchain -c "./gradlew publish --no-daemon -Pversion=$VERSION" || true \ No newline at end of file +su blockchain -c "./gradlew publish --no-daemon -Pversion=$VERSION" || true