Skip to content

Commit

Permalink
node: add kokoro configs for autorelease
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwlui committed Dec 11, 2018
1 parent 27938e0 commit 60561f7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
31 changes: 31 additions & 0 deletions synthtool/gcp/templates/node_library/.kokoro/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

export NPM_CONFIG_PREFIX=/home/node/.npm-global

# Start the releasetool reporter
python3 -m pip install gcp-releasetool
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script

cd $(dirname $0)/..

NPM_TOKEN=$(cat $KOKORO_KEYSTORE_DIR/73713_google_cloud_npm_token)
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

npm install
npm publish --access=public
28 changes: 28 additions & 0 deletions synthtool/gcp/templates/node_library/.kokoro/release/publish.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Get npm token from Keystore
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google_cloud_npm_token"
backend_type: FASTCONFIGPUSH
}
}
}


# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "nodejs-scheduler/.kokoro/trampoline.sh"

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/{{ metadata['repository_name'] }}/.kokoro/publish.sh"
}

0 comments on commit 60561f7

Please sign in to comment.