File tree Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Original file line number Diff line number Diff line change 11name : CI
22
33on :
4- # Trigger the workflow on push or pull request,
5- # but only for the master branch
64 push :
75 branches :
86 - master
Original file line number Diff line number Diff line change 1+ name : release-kpt-functions
2+
3+ on :
4+ push :
5+ tags :
6+ - release-kpt-functions-*
7+
8+ jobs :
9+ node-ci :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v1
13+ - name : Use Node.js 12.x
14+ uses : actions/setup-node@v1
15+ with :
16+ node-version : 12.x
17+ registry-url : ' https://npm.pkg.github.com'
18+ - name : Install, test
19+ run : |
20+ cd ts/kpt-functions
21+ npm ci
22+ npm test
23+ - name : Publish
24+ run : |
25+ cd ts/kpt-functions
26+ ../../scripts/publish-npm.sh $GITHUB_REF
27+ env :
28+ NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Copyright 2019 Google LLC
3+ #
4+ # Licensed under the Apache License, Version 2.0 (the "License");
5+ # you may not use this file except in compliance with the License.
6+ # You may obtain a copy of the License at
7+ #
8+ # http://www.apache.org/licenses/LICENSE-2.0
9+ #
10+ # Unless required by applicable law or agreed to in writing, software
11+ # distributed under the License is distributed on an "AS IS" BASIS,
12+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ # See the License for the specific language governing permissions and
14+ # limitations under the License.
15+
16+ set -euo pipefail
17+
18+ TAG_VERSION=${1#* -v} ;
19+ echo " tag version: $TAG_VERSION "
20+
21+ PACKAGE_VERSION=$( node -p " require('./package.json').version" )
22+ echo " package version: $PACKAGE_VERSION "
23+
24+ if [[ " $PACKAGE_VERSION " != " $TAG_VERSION " ]]; then
25+ echo " package version does not match the tag"
26+ exit 1
27+ fi
28+
29+
30+ if [[ " $PACKAGE_VERSION " == * " rc" * ]]; then
31+ npm publish --tag rc
32+ else
33+ npm publish
34+ fi
You can’t perform that action at this time.
0 commit comments