mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 17:01:04 -06:00
ebcf7455eb
* Rename module name from "github.com/hashicorp/terraform" to "github.com/placeholderplaceholderplaceholder/opentf". Signed-off-by: Jakub Martin <kubam@spacelift.io> * Gofmt. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Regenerate protobuf. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Fix comments. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Undo issue and pull request link changes. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Undo comment changes. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Fix comment. Signed-off-by: Jakub Martin <kubam@spacelift.io> * Undo some link changes. Signed-off-by: Jakub Martin <kubam@spacelift.io> * make generate && make protobuf Signed-off-by: Jakub Martin <kubam@spacelift.io> --------- Signed-off-by: Jakub Martin <kubam@spacelift.io>
42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
set -uo pipefail
|
|
|
|
# Trim the "v" prefix, if any.
|
|
VERSION="${RAW_VERSION#v}"
|
|
|
|
# Split off the build metadata part, if any
|
|
# (we won't actually include it in our final version, and handle it only for
|
|
# compleness against semver syntax.)
|
|
IFS='+' read -ra VERSION BUILD_META <<< "$VERSION"
|
|
|
|
# Separate out the prerelease part, if any
|
|
# (version.go expects it to be in a separate variable)
|
|
IFS='-' read -r BASE_VERSION PRERELEASE <<< "$VERSION"
|
|
|
|
EXPERIMENTS_ENABLED=0
|
|
if [[ "$PRERELEASE" == alpha* ]]; then
|
|
EXPERIMENTS_ENABLED=1
|
|
fi
|
|
if [[ "$PRERELEASE" == dev* ]]; then
|
|
EXPERIMENTS_ENABLED=1
|
|
fi
|
|
|
|
LDFLAGS="-w -s"
|
|
if [[ "$EXPERIMENTS_ENABLED" == 1 ]]; then
|
|
LDFLAGS="${LDFLAGS} -X 'main.experimentsAllowed=yes'"
|
|
fi
|
|
LDFLAGS="${LDFLAGS} -X 'github.com/placeholderplaceholderplaceholder/opentf/version.dev=no'"
|
|
|
|
echo "Building Terraform CLI ${VERSION}"
|
|
if [[ "$EXPERIMENTS_ENABLED" == 1 ]]; then
|
|
echo "This build allows use of experimental features"
|
|
fi
|
|
echo "product-version=${VERSION}" | tee -a "${GITHUB_OUTPUT}"
|
|
echo "product-version-base=${BASE_VERSION}" | tee -a "${GITHUB_OUTPUT}"
|
|
echo "product-version-pre=${PRERELEASE}" | tee -a "${GITHUB_OUTPUT}"
|
|
echo "experiments=${EXPERIMENTS_ENABLED}" | tee -a "${GITHUB_OUTPUT}"
|
|
echo "go-ldflags=${LDFLAGS}" | tee -a "${GITHUB_OUTPUT}"
|