Skip to content

feat(FC-1287) Added GA integration with automatic publishing #7

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
16 changes: 16 additions & 0 deletions .github/workflows/main-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: main pipeline

on:
push:
branches:
- 'master'
jobs:
test_libraries:
uses: blockchain/devx-workflows/.github/workflows/[email protected]
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 }}
16 changes: 16 additions & 0 deletions .github/workflows/pr-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pr pipeline

on:
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
test_libraries:
uses: blockchain/devx-workflows/.github/workflows/[email protected]
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 }}
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
allprojects {
group = 'com.blockchain.btcd-cli4j'
version = '0.5.8.16'
}

subprojects {
Expand Down
9 changes: 9 additions & 0 deletions scripts/publish_lib.sh
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions scripts/version.sh
Original file line number Diff line number Diff line change
@@ -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