diff --git a/ci/add-plugin-installer-script.js b/ci/add-plugin-installer-script.js index 1d75d34..26f8c22 100644 --- a/ci/add-plugin-installer-script.js +++ b/ci/add-plugin-installer-script.js @@ -33,11 +33,27 @@ stdin.on("close", function() { if (!packageJSON.scripts) { packageJSON.scripts = {}; } + var name = packageJSON.name; if (name.lastIndexOf("/") !== -1) { name = name.substring(name.lastIndexOf("/")+1); } - packageJSON.scripts["install"] = `node scripts/install-pulumi-plugin.js resource ${name} ${packageJSON.version}`; + if (name.lastIndexOf("-") !== -1) { + name = name.substring(name.lastIndexOf("-")+1); + } + + var args; + + + if (packageJSON.pulumi.pluginDownloadURL) { + args = `resource ${name} --server ${packageJSON.pulumi.pluginDownloadURL} ${packageJSON.version}` + } else if (packageJSON.pulumi.server) { + args = `resource ${name} --server ${packageJSON.pulumi.server} ${packageJSON.version}` + } else { + args = `resource ${name} ${packageJSON.version}` + } + + packageJSON.scripts["install"] = `node scripts/install-pulumi-plugin.js ${args}`; // Now print out the result to stdout. console.log(JSON.stringify(packageJSON, null, 4)); diff --git a/ci/publish-tfgen-package b/ci/publish-tfgen-package index 65e9147..809eb92 100755 --- a/ci/publish-tfgen-package +++ b/ci/publish-tfgen-package @@ -32,14 +32,18 @@ if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then # First, add an install script to our package.json mkdir -p "${SOURCE_ROOT}/sdk/nodejs/bin/scripts" - cp "${SCRIPT_ROOT}/install-pulumi-plugin.js" \ - "${SOURCE_ROOT}/sdk/nodejs/bin/scripts" + if [ ! -f "${SOURCE_ROOT}/sdk/nodejs/bin/scripts/install-pulumi-plugin.js" ]; then + echo "Didn't find existing plugin plugin installer" + cp "${SCRIPT_ROOT}/install-pulumi-plugin.js" \ + "${SOURCE_ROOT}/sdk/nodejs/bin/scripts" + fi node "${SCRIPT_ROOT}/add-plugin-installer-script.js" < \ "${SOURCE_ROOT}/sdk/nodejs/bin/package.json" > \ "${SOURCE_ROOT}/sdk/nodejs/bin/package.json.publish" pushd "${SOURCE_ROOT}/sdk/nodejs/bin" mv package.json package.json.dev mv package.json.publish package.json + cat package.json NPM_TAG="dev" @@ -84,7 +88,7 @@ if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then # We exploit the fact that `npm info @` has no output # when the package does not exist. if [ "$(npm info ${PKG_NAME}@${PKG_VERSION})" == "" ]; then - if ! npm publish -tag "${NPM_TAG}"; then + if ! npm publish --access public -tag "${NPM_TAG}"; then # if we get here, we have a TOCTOU issue, so check again # to see if it published. If it didn't bail out. if [ "$(npm info ${PKG_NAME}@${PKG_VERSION})" == "" ]; then @@ -121,7 +125,7 @@ if [[ "${TRAVIS_OS_NAME:-}" == "linux" ]]; then # Finally, publish the NuGet package if any exists. if [ -n "${NUGET_PUBLISH_KEY}" ]; then - find "${SOURCE_ROOT}/sdk/dotnet/bin/Debug/" -name 'Pulumi.*.nupkg' \ - -exec dotnet nuget push -k "${NUGET_PUBLISH_KEY}" -s https://api.nuget.org/v3/index.json {} ';' + find "${SOURCE_ROOT}/sdk/dotnet/bin/Debug/" -name '*.*.nupkg' | \ + xargs dotnet nuget push -k "${NUGET_PUBLISH_KEY}" -s https://api.nuget.org/v3/index.json fi fi