mirror of
https://github.com/vmware-tanzu/velero.git
synced 2025-12-23 06:15:21 +00:00
goreleaser scripts for building/creating a release on a workstation
Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
53
.goreleaser.yml
Normal file
53
.goreleaser.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
# Copyright 2018 the Heptio Ark contributors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
dist: _output
|
||||
builds:
|
||||
- main: ./cmd/ark/main.go
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
ignore:
|
||||
# don't build arm/arm64 for darwin or windows
|
||||
- goos: darwin
|
||||
goarch: arm
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
- goos: windows
|
||||
goarch: arm
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
ldflags:
|
||||
- -X "github.com/heptio/ark/pkg/buildinfo.Version={{ .Version }}" -X "github.com/heptio/ark/pkg/buildinfo.GitSHA={{ .Env.GIT_SHA }}" -X "github.com/heptio/ark/pkg/buildinfo.GitTreeState={{ .Env.GIT_TREE_STATE }}"
|
||||
archive:
|
||||
name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
|
||||
files:
|
||||
- LICENSE
|
||||
- examples/**/*
|
||||
checksum:
|
||||
name_template: 'CHECKSUM'
|
||||
snapshot:
|
||||
name_template: "{{ .Env.GIT_SHA }}"
|
||||
release:
|
||||
github:
|
||||
owner: heptio
|
||||
name: ark
|
||||
draft: true
|
||||
3
Makefile
3
Makefile
@@ -233,3 +233,6 @@ clean:
|
||||
docker rmi $(BUILDER_IMAGE)
|
||||
|
||||
ci: all verify test
|
||||
|
||||
goreleaser:
|
||||
hack/goreleaser.sh
|
||||
|
||||
52
hack/goreleaser.sh
Executable file
52
hack/goreleaser.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2018 the Heptio Ark contributors.
|
||||
#
|
||||
# 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.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
# $PUBLISH must explicitly be set to 'true' for goreleaser
|
||||
# to publish the release to GitHub.
|
||||
if [ "${PUBLISH:-}" != "true" ]; then
|
||||
SKIP_PUBLISH="--skip-publish"
|
||||
else
|
||||
SKIP_PUBLISH=""
|
||||
fi
|
||||
|
||||
if [ -z "${GITHUB_TOKEN}" ]; then
|
||||
echo "GITHUB_TOKEN must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO derive this from the major+minor version
|
||||
if [ -z "${RELEASE_NOTES_FILE}" ]; then
|
||||
echo "RELEASE_NOTES_FILE must be set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export GIT_SHA=$(git describe --tags --always)
|
||||
|
||||
GIT_DIRTY=$(git status --porcelain 2> /dev/null)
|
||||
if [[ -z "${GIT_DIRTY}" ]]; then
|
||||
export GIT_TREE_STATE=clean
|
||||
else
|
||||
export GIT_TREE_STATE=dirty
|
||||
fi
|
||||
|
||||
goreleaser release \
|
||||
--rm-dist \
|
||||
--release-notes="${RELEASE_NOTES_FILE}" \
|
||||
"${SKIP_PUBLISH}"
|
||||
Reference in New Issue
Block a user