Upload distributions to Cloudsmith (#15)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
This commit is contained in:
Fabio Di Fabio
2023-10-05 15:55:41 +02:00
committed by GitHub
parent 4aa2e475f3
commit 90bdd3cb6d
3 changed files with 42 additions and 12 deletions

View File

@@ -58,11 +58,14 @@ jobs:
CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }}
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
- name: Store distribution artifacts
uses: actions/upload-artifact@v3
with:
name: distributions
path: build/distributions
- name: Publish distribution artifacts
run: |
sudo apt update
sudo apt install -y python3 python3-pip python3-venv
./gradlew cloudsmithUpload
env:
CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_USER }}
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
- name: Check Dockerfile syntax
run: |

View File

@@ -590,6 +590,7 @@ distTar {
}
compression = Compression.GZIP
archiveExtension = 'tar.gz'
archiveBaseName = 'linea-besu'
}
distZip {
@@ -597,6 +598,7 @@ distZip {
doFirst {
delete fileTree(dir: 'build/distributions', include: '*.zip')
}
archiveBaseName = 'linea-besu'
}
publishing {
@@ -604,9 +606,9 @@ publishing {
distArtifactory(MavenPublication) {
groupId = '.'
version = project.version
artifactId = 'besu'
artifact("$buildDir/distributions/besu-${project.version}.zip")
artifact("$buildDir/distributions/besu-${project.version}.tar.gz") { extension = 'tar.gz' }
artifactId = 'linea-besu'
artifact("$buildDir/distributions/linea-besu-${project.version}.zip")
artifact("$buildDir/distributions/linea-besu-${project.version}.tar.gz") { extension = 'tar.gz' }
}
}
}
@@ -1009,9 +1011,15 @@ distributions {
}
}
task cloudsmithUpload {
dependsOn([distTar, distZip])
doLast {
exec {
executable project.file("scripts/cloudsmith-upload.sh")
args rootProject.version, distTar.archiveFile.get(), distZip.archiveFile.get()
}
}
}
check.dependsOn checkSpdxHeader
build.dependsOn verifyDistributions
artifactoryPublish.dependsOn verifyDistributions
artifactoryPublish.mustRunAfter(distTar)
artifactoryPublish.mustRunAfter(distZip)
artifactoryPublish.mustRunAfter(javadocJar)

19
scripts/cloudsmith-upload.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail
LINEA_BESU_VERSION=${1:?Must specify Linea Besu version}
TAR_DIST=${2:?Must specify path to tar distribution}
ZIP_DIST=${3:?Must specify path to zip distribution}
ENV_DIR=./build/tmp/cloudsmith-env
if [[ -d ${ENV_DIR} ]] ; then
source ${ENV_DIR}/bin/activate
else
python3 -m venv ${ENV_DIR}
source ${ENV_DIR}/bin/activate
fi
python3 -m pip install --upgrade cloudsmith-cli
cloudsmith push raw consensys/linea-besu $TAR_DIST --republish --name 'linea-besu.tar.gz' --version "${LINEA_BESU_VERSION}" --summary "Linea Besu ${LINEA_BESU_VERSION} binary distribution" --description "Binary distribution of Linea Besu ${LINEA_BESU_VERSION}." --content-type 'application/tar+gzip'
cloudsmith push raw consensys/linea-besu $ZIP_DIST --republish --name 'linea-besu.zip' --version "${LINEA_BESU_VERSION}" --summary "Linea Besu ${LINEA_BESU_VERSION} binary distribution" --description "Binary distribution of Linea Besu ${LINEA_BESU_VERSION}." --content-type 'application/zip'