2018-03-06 23:36:50 +01:00
|
|
|
#!/bin/bash
|
|
|
|
# publish_packages.sh uploads our packages to package repositories like npm
|
2018-09-03 18:49:57 +02:00
|
|
|
set -o nounset
|
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
readonly ROOT=$(dirname "${0}")/..
|
2018-03-06 23:36:50 +01:00
|
|
|
|
2019-01-23 21:13:19 +01:00
|
|
|
NPM_VERSION=$("${ROOT}/scripts/get-version")
|
|
|
|
"${ROOT}/scripts/build-sdk.sh" $(echo ${NPM_VERSION} | sed -e 's/\+.*//g') $(git rev-parse HEAD)
|
|
|
|
|
2018-04-15 07:25:35 +02:00
|
|
|
if [[ "${TRAVIS_PUBLISH_PACKAGES:-}" == "true" ]]; then
|
2018-03-06 23:36:50 +01:00
|
|
|
echo "Publishing NPM package to NPMjs.com:"
|
2018-04-05 23:03:20 +02:00
|
|
|
NPM_TAG="dev"
|
|
|
|
|
2019-01-31 23:07:48 +01:00
|
|
|
if [[ "${TRAVIS_BRANCH:-}" == features/* ]]; then
|
|
|
|
NPM_TAG=$(echo "${TRAVIS_BRANCH}" | sed -e 's|^features/|feature-|g')
|
|
|
|
fi
|
|
|
|
|
2019-08-13 20:41:32 +02:00
|
|
|
# If the package doesn't have an alpha tag, use the tag of latest instead of
|
2018-04-05 23:03:20 +02:00
|
|
|
# dev. NPM uses this tag as the default version to add, so we want it to mean
|
|
|
|
# the newest released version.
|
2019-08-13 20:41:32 +02:00
|
|
|
if [[ $(jq -r .version < "${ROOT}/sdk/nodejs/bin/package.json") != *-alpha* ]]; then
|
2018-04-05 23:03:20 +02:00
|
|
|
NPM_TAG="latest"
|
|
|
|
fi
|
|
|
|
|
2018-09-03 18:49:57 +02:00
|
|
|
pushd "${ROOT}/sdk/nodejs/bin" && \
|
2018-04-05 23:03:20 +02:00
|
|
|
npm publish --tag "${NPM_TAG}" && \
|
2018-03-06 23:36:50 +01:00
|
|
|
npm info 2>/dev/null || true && \
|
|
|
|
popd
|
|
|
|
|
|
|
|
echo "Publishing Pip package to pulumi.com:"
|
|
|
|
twine upload \
|
2018-09-03 18:49:57 +02:00
|
|
|
-u pulumi -p "${PYPI_PASSWORD}" \
|
|
|
|
"${ROOT}/sdk/python/env/src/dist"/*.whl
|
2018-04-11 20:33:53 +02:00
|
|
|
|
2019-01-23 21:13:19 +01:00
|
|
|
"${ROOT}/scripts/build-and-publish-docker" "${NPM_VERSION}"
|
2019-09-05 21:20:48 +02:00
|
|
|
|
|
|
|
"$(go env GOPATH)/src/github.com/pulumi/scripts/ci/build-package-docs.sh" pulumi
|
2019-01-23 21:13:19 +01:00
|
|
|
fi
|
2018-09-03 18:49:57 +02:00
|
|
|
|
2019-01-23 21:13:19 +01:00
|
|
|
exit 0
|