Skip to content

Commit b6fc3e3

Browse files
committed
Gate edge/latest S3 publish on master branch and fix md5 upload
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
1 parent 2127474 commit b6fc3e3

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ String gitVersion() {
5353
return r==0 ? p.text.trim() : '(unknown)'
5454
}
5555

56+
String gitBranch() {
57+
def fromCI = System.env.GITHUB_REF_NAME
58+
if( fromCI ) return fromCI.trim()
59+
def p = new ProcessBuilder() .command('sh','-c','git rev-parse --abbrev-ref HEAD') .start()
60+
def r = p.waitFor()
61+
def out = r==0 ? p.text.trim() : ''
62+
return (out && out != 'HEAD') ? out : '(unknown)'
63+
}
64+
5665
group = 'io.nextflow'
5766
version = rootProject.file('VERSION').text.trim()
5867
ext.commitId = gitVersion()

packing.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ task dockerPack(type: Exec, dependsOn: ['packOne']) {
239239
task release(type: Exec, dependsOn: [pack, dockerImage, validatePluginVersions]) {
240240

241241
def launcherFile = file('nextflow').absoluteFile
242+
def launcherMd5 = file('nextflow.md5').absoluteFile
242243
def launcherSha1 = file('nextflow.sha1').absoluteFile
243244
def launcherSha256 = file('nextflow.sha256').absoluteFile
244245
def nextflowAllFile = file("$releaseDir/nextflow-${version}-dist")
@@ -247,6 +248,7 @@ task release(type: Exec, dependsOn: [pack, dockerImage, validatePluginVersions])
247248
def snapshot = version ==~ /^.+(-RC\d+|-SNAPSHOT)$/
248249
def edge = version ==~ /^.+(-edge|-EDGE)$/
249250
def isLatest = !snapshot && !edge
251+
def branch = gitBranch()
250252
def cmd = """\
251253
# tag the release
252254
git push || exit \$?
@@ -257,27 +259,27 @@ task release(type: Exec, dependsOn: [pack, dockerImage, validatePluginVersions])
257259
gh release upload --repo nextflow-io/nextflow v$version ${launcherFile} ${nextflowAllFile}
258260
""".stripIndent()
259261

260-
if( edge )
262+
if( edge && branch == 'master' )
261263
cmd += """
262264
# publish the script as the latest
263265
export AWS_ACCESS_KEY_ID=${System.env.NXF_AWS_ACCESS}
264266
export AWS_SECRET_ACCESS_KEY=${System.env.NXF_AWS_SECRET}
265267
aws s3 cp $launcherFile s3://www2.nextflow.io/releases/edge/nextflow $s3CmdOpts
266268
aws s3 cp $launcherSha1 s3://www2.nextflow.io/releases/edge/nextflow.sha1 $s3CmdOpts
267269
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/edge/nextflow.sha256 $s3CmdOpts
268-
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/edge/nextflow.md5 $s3CmdOpts
270+
aws s3 cp $launcherMd5 s3://www2.nextflow.io/releases/edge/nextflow.md5 $s3CmdOpts
269271
aws s3 cp $versionFile s3://www2.nextflow.io/releases/edge/version $s3CmdOpts
270272
""".stripIndent()
271-
272-
else if( isLatest )
273+
274+
else if( isLatest && branch == 'master' )
273275
cmd += """
274276
# publish the script as the latest
275277
export AWS_ACCESS_KEY_ID=${System.env.NXF_AWS_ACCESS}
276278
export AWS_SECRET_ACCESS_KEY=${System.env.NXF_AWS_SECRET}
277279
aws s3 cp $launcherFile s3://www2.nextflow.io/releases/latest/nextflow $s3CmdOpts
278280
aws s3 cp $launcherSha1 s3://www2.nextflow.io/releases/latest/nextflow.sha1 $s3CmdOpts
279281
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/latest/nextflow.sha256 $s3CmdOpts
280-
aws s3 cp $launcherSha256 s3://www2.nextflow.io/releases/latest/nextflow.md5 $s3CmdOpts
282+
aws s3 cp $launcherMd5 s3://www2.nextflow.io/releases/latest/nextflow.md5 $s3CmdOpts
281283
aws s3 cp $versionFile s3://www2.nextflow.io/releases/latest/version $s3CmdOpts
282284
""".stripIndent()
283285

0 commit comments

Comments
 (0)