forked from kubernetes-sigs/kubebuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild.yaml
51 lines (49 loc) · 2.2 KB
/
cloudbuild.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright 2018 The Kubernetes Authors.
#
# 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
#
# http://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.
# Instructions to run locally:
# Download google container builder: https://github.com/GoogleCloudPlatform/cloud-build-local
# $ mkdir cloudbuild
# $ cloud-build-local --config=build/cloudbuild_local.yaml --dryrun=false --write-workspace=./cloudbuild .
# Release tar will be in ./cloudbuild
steps:
- name: "gcr.io/cloud-builders/git"
entrypoint: 'bash'
args:
- '-c'
- |
git fetch --tags --unshallow
git for-each-ref --contains HEAD
# TAG_NAME is defined by GCB, so uses 1 dollar sign, BRANCH_NAME is bash, so we need to escape it
# with two dollar signs
export BRANCH_NAME=$(git for-each-ref --format="%(refname:strip=-1)" --contains HEAD 'refs/remotes/origin/release-*')
export ALL_BRANCHES=$(git for-each-ref --format="%(refname:strip=-1)" 'refs/remotes/origin/release-*')
echo "branch: $${BRANCH_NAME}, tag: ${TAG_NAME}, all release branches: $${ALL_BRANCHES}"
for branch in $${ALL_BRANCHES}; do
git branch $${branch} origin/$${branch}
done
git branch -f $${BRANCH_NAME} HEAD
git checkout $${BRANCH_NAME}
git branch --set-upstream-to=origin/$${BRANCH_NAME}
git tag -d ${TAG_NAME}
- name: "goreleaser/goreleaser:v0.147"
entrypoint: "bash"
args: ["build/build_kubebuilder.sh"]
secretEnv: ["GITHUB_TOKEN"]
env:
- 'TAG_NAME=$TAG_NAME'
- 'CLOUD_BUILD=true'
secrets:
- kmsKeyName: projects/kubebuilder/locations/global/keyRings/kubebuilder-gh-tokens/cryptoKeys/gh-release-token
secretEnv:
GITHUB_TOKEN: CiQAChsKTruEiSo6yBI+xg75jyr4f8yM93R2e9QbpeRX3jF3VAwSUQDQuYkCiUd+6e/1wKQAyHnf6BYv0GNGMghyNzYbXT0owBzQqmIQJeu/VDGZcEVabIWErNXjbPqPiysIu0uAiKAAUTUK0VYMr9E6GdTJ0+hVmg==