forked from GoogleCloudPlatform/cloud-build-local
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudbuild_tag.yaml
29 lines (29 loc) · 1.21 KB
/
cloudbuild_tag.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
# This build is triggered when a new tag is created in order to compile
# binaries and copy them to GCS.
steps:
# Run unit tests in all subdirectories (except those excluded by the grep).
- name: 'gcr.io/cloud-builders/go:wheezy'
entrypoint: 'bash'
args:
- '-c'
- |
find . -type d -maxdepth 1 | grep -Ev "vendor|.git|gopath|integration_tests" | xargs /builder/bin/go.bash test
# Set TAG_NAME as version.
- name: 'ubuntu'
args: ['sed', '-i', 's/HEAD/$TAG_NAME/g', 'version.go']
# Create binaries for each pair of OS/Arch.
# Create an archive with the latest binaries; that enables a single download url.
- name: 'gcr.io/cloud-builders/go:wheezy'
entrypoint: 'bash'
args:
- '-c'
- |
for GOOS in darwin linux; do
for GOARCH in 386 amd64; do
# Build binary with the new tag and with 'latest'
GOOS=$$GOOS GOARCH=$$GOARCH /builder/bin/go.bash build -o container-builder-local_$${GOOS}_$${GOARCH}-$TAG_NAME github.com/GoogleCloudPlatform/container-builder-local
done
done
tar -czvf container-builder-local_latest.tar.gz container-builder-local_*
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', 'container-builder-local_*', 'gs://container-builder-local/']