Skip to content

Commit 5c9277f

Browse files
mbwhitejt-nti
authored andcommitted
Fixes for JAR publishing
Signed-off-by: Matthew B White <[email protected]>
1 parent 14a5b77 commit 5c9277f

File tree

2 files changed

+81
-6
lines changed

2 files changed

+81
-6
lines changed

.github/workflows/build.yml

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@
55
name: Fabric Chaincode and Smart Contract - Java
66
on:
77
push:
8-
branches: ["**"]
8+
branches:
9+
- main
10+
- release-2.5
911
pull_request:
10-
branches: ["**"]
11-
workflow_dispatch:
12+
branches:
13+
- main
14+
- release-2.5
15+
create:
16+
tags:
17+
- "*"
1218

1319
jobs:
1420
build:
@@ -72,4 +78,69 @@ jobs:
7278
:fabric-chaincode-integration-test:build
7379
-xdependencyCheckAnalyze
7480
75-
81+
82+
publishjars:
83+
runs-on: ubuntu-latest
84+
needs: [build]
85+
if: startsWith(github.ref, 'refs/tags/')
86+
steps:
87+
- uses: actions/checkout@v3
88+
- uses: actions/setup-java@v3
89+
with:
90+
distribution: 'temurin'
91+
java-version: '11'
92+
cache: 'gradle'
93+
- name: Validate Gradle wrapper
94+
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
95+
- name: Push to registry
96+
run: |
97+
set -xev
98+
99+
./gradlew -Psigning.key=${SIGNING_KEY} -Psigning.password=${SIGNING_PASSWORD} -PossrhUsername=${OSSRH_USER} -PossrhPassword=${OSSRH_PASSWORD} publishAllPublicationsToReleaseRepository
100+
env:
101+
SIGNING_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
102+
SIGNING_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
103+
OSSRH_USER: ${{ secrets.OSSRH_USERNAME }}
104+
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }}}
105+
106+
107+
publishdocker:
108+
runs-on: ubuntu-latest
109+
needs: [setup,build]
110+
if: startsWith(github.ref, 'refs/tags/')
111+
steps:
112+
- uses: actions/checkout@v3
113+
- uses: actions/setup-java@v3
114+
with:
115+
distribution: 'temurin'
116+
java-version: '11'
117+
cache: 'gradle'
118+
- uses: actions/download-artifact@v3
119+
with:
120+
name: javaenv-docker-image
121+
path: build/
122+
- name: Push to registry
123+
run: |
124+
set -xev
125+
wget -qO "$PWD/manifest-tool" https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64
126+
chmod +x ./manifest-tool
127+
128+
# just debuging
129+
echo ${{ needs.setup.outputs.PACKAGE_VERSION }}
130+
echo "Version strings are ${PACKAGE_VERSION} ${MINOR_PACKAGE_VERSION}"
131+
132+
docker image load --input build/fabric-javaenv.tar.gz
133+
docker images
134+
docker login ${DOCKER_REGISTRY_URL} --username=${DOCKER_REGISTRY_USERNAME} --password=${DOCKER_REGISTRY_PASSWORD}
135+
echo "Logged in to docker registry"
136+
# tag javaenv image to PACKAGE_VERSION
137+
docker tag hyperledger/fabric-javaenv hyperledger/fabric-javaenv:amd64-${PACKAGE_VERSION}
138+
# push javaenv to repository
139+
docker push hyperledger/fabric-javaenv:amd64-${PACKAGE_VERSION}
140+
./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-javaenv:amd64-${PACKAGE_VERSION}" --target "hyperledger/fabric-javaenv:${PACKAGE_VERSION}"
141+
./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-javaenv:amd64-${PACKAGE_VERSION}" --target "hyperledger/fabric-javaenv:${MINOR_PACKAGE_VERSION}"
142+
env:
143+
DOCKER_REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
144+
DOCKER_REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
145+
PACAKGE_VERSION: ${{ needs.setup.outputs.PACKAGE_VERSION }}
146+
MINOR_PACKAGE_VERSION: ${{ needs.setup.outputs.MINOR_PACKAGE_VERSION }}

fabric-chaincode-shim/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ tasks.withType(org.gradle.api.tasks.testing.Test) {
4141
}
4242

4343
dependencies {
44-
implementation group: 'org.hyperledger.fabric', name:'fabric-protos', version:'0.1.3'
44+
implementation group: 'org.hyperledger.fabric', name:'fabric-protos', version:'0.3.0'
4545
implementation 'org.bouncycastle:bcpkix-jdk15on:1.62'
4646
implementation 'org.bouncycastle:bcprov-jdk15on:1.62'
4747
implementation group: 'io.github.classgraph', name: 'classgraph', version: '4.8.146'
@@ -341,7 +341,11 @@ publishing {
341341
}
342342

343343
signing {
344-
if (project.findProperty('signing.keyId')) {
344+
if (project.findProperty('signing.key')) {
345+
def signingKey = findProperty("signing.key")
346+
def signingPassword = findProperty("signing.password")
347+
useInMemoryPgpKeys(signingKey, signingPassword)
348+
345349
sign publishing.publications.shim
346350
sign publishing.publications.shimJar
347351
}

0 commit comments

Comments
 (0)