From af41297803f450bc2e9a7287bcc7c0d43d5787b8 Mon Sep 17 00:00:00 2001 From: Mark Iantorno Date: Wed, 27 May 2020 10:57:39 -0400 Subject: [PATCH] Adding Pipeline to publish SNAPSHOT for each module [skip ci] --- module-snapshot-publishing.yml | 107 +++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 module-snapshot-publishing.yml diff --git a/module-snapshot-publishing.yml b/module-snapshot-publishing.yml new file mode 100644 index 000000000..b2b4ad8b1 --- /dev/null +++ b/module-snapshot-publishing.yml @@ -0,0 +1,107 @@ +# This pipeline produces a SNAPSHOT build for each of the sub modules in +# the core library, and publishes them to ossrh. +trigger: + - master + +strategy: + matrix: + dstu2: + module: "org.hl7.fhir.dstu2" + dstu3: + module: "org.hl7.fhir.dstu3" + dstu2016may: + module: "org.hl7.fhir.dstu2016may" + r4: + module: "org.hl7.fhir.r4" + r5: + module: "org.hl7.fhir.r5" + validator: + module: "org.hl7.fhir.validation" + maxParallel: 3 + +pool: + vmImage: "ubuntu-16.04" + +variables: + currentModule: $(module) + +steps: + # Debugging output to identify current module. + - bash: echo Publishing SNAPSHOT for $(module) + + # Signing, for now, occurs for all builds, SNAPSHOT or release. So we need a valid + # signing key. The next two steps download the public and private keys from the + # secure library files. + - task: DownloadSecureFile@1 + displayName: 'Download public key.' + inputs: + secureFile: public.key + + - task: DownloadSecureFile@1 + displayName: 'Download private key.' + inputs: + secureFile: private.key + + # Import both the private and public keys into gpg for signing. + - bash: | + gpg --import --no-tty --batch --yes $(Agent.TempDirectory)/public.key + gpg --import --no-tty --batch --yes $(Agent.TempDirectory)/private.key + gpg --list-keys --keyid-format LONG + gpg --list-secret-keys --keyid-format LONG + displayName: 'Import signing keys.' + + # For creating the snapshot release with maven, we need to build a fake settings.xml + # for it to read from. This is done for the master branch merges only. + - bash: | + cat >$(System.DefaultWorkingDirectory)/settings.xml < + + + ossrh + $(SONATYPE_USER) + $(SONATYPE_PASS) + + + sonatype-nexus-snapshots + $(SONATYPE_USER) + $(SONATYPE_PASS) + + + sonatype-nexus-staging + $(SONATYPE_USER) + $(SONATYPE_PASS) + + + $(PGP_KEYNAME) + $(PGP_PASSPHRASE) + + + + + release + + true + + + $(PGP_KEYNAME) + + + + + EOL + displayName: 'Create .mvn/settings.xml' + condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + + # Deploy the SNAPSHOT artifact to sonatype nexus. + # This is done for the master branch merges only. + - task: Maven@3 + displayName: 'Deploy $(version) to Sonatype staging' + condition: and(eq(variables.currentImage, 'ubuntu-16.04'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + inputs: + mavenPomFile: '$(System.DefaultWorkingDirectory)/$(module)/pom.xml' + goals: deploy + options: '--settings $(System.DefaultWorkingDirectory)/settings.xml ' + publishJUnitResults: false \ No newline at end of file