Skip to content

Commit bdc371d

Browse files
include a release script for the sample-controller (#483)
Co-authored-by: dprotaso <[email protected]>
1 parent 6e00623 commit bdc371d

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

hack/release.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright 2021 The Knative Authors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
source $(dirname $0)/../vendor/knative.dev/hack/release.sh
19+
20+
declare -A COMPONENTS
21+
COMPONENTS=(
22+
["sample.yaml"]="config"
23+
)
24+
readonly COMPONENTS
25+
26+
function build_release() {
27+
# Update release labels if this is a tagged release
28+
if [[ -n "${TAG}" ]]; then
29+
echo "Tagged release, updating release labels to samples.knative.dev/release: \"${TAG}\""
30+
LABEL_YAML_CMD=(sed -e "s|samples.knative.dev/release: devel|samples.knative.dev/release: \"${TAG}\"|")
31+
else
32+
echo "Untagged release, will NOT update release labels"
33+
LABEL_YAML_CMD=(cat)
34+
fi
35+
36+
local all_yamls=()
37+
for yaml in "${!COMPONENTS[@]}"; do
38+
local config="${COMPONENTS[${yaml}]}"
39+
echo "Building Knative Sample Controller - ${config}"
40+
ko resolve ${KO_FLAGS} -f ${config}/ | "${LABEL_YAML_CMD[@]}" > ${yaml}
41+
all_yamls+=(${yaml})
42+
done
43+
ARTIFACTS_TO_PUBLISH="${all_yamls[@]}"
44+
}
45+
46+
main $@

0 commit comments

Comments
 (0)