pulumi/scripts/publish_packages.sh
Pat Gavlin 9df29893ba
Build new docs when publishing tagged releases. (#3181)
These changes wire up a new script that clones
https://github.com/pulumi/docs, regenerates the appropriate parts of the
docs site, and opens a pull request with the changes. This script
executes on any build in which we publish packages that _also_ has a tag
present.
2019-09-05 12:20:48 -07:00

42 lines
1.3 KiB
Bash
Executable file

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