mirror of
https://github.com/terraform-docs/terraform-docs.git
synced 2026-03-27 12:58:35 +07:00
Fix release scripts (#175)
This commit is contained in:
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -51,4 +51,4 @@ jobs:
|
||||
with:
|
||||
formula-name: terraform-docs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
|
||||
|
||||
3
Makefile
3
Makefile
@@ -103,6 +103,9 @@ build-all: clean ## Build binary for all OS/ARCH
|
||||
#####################
|
||||
PATTERN =
|
||||
|
||||
# if the last relase was alpha, beta or rc, 'release' target has to used with current
|
||||
# cycle release. For example if latest tag is v0.8.0-rc.2 and v0.8.0 GA needs to get
|
||||
# released the following should be executed: "make release version=0.8.0"
|
||||
.PHONY: release
|
||||
release: version ?= $(shell echo $(VERSION) | sed 's/^v//' | awk -F'[ .]' '{print $(PATTERN)}')
|
||||
release: ## Prepare release
|
||||
|
||||
@@ -41,7 +41,7 @@ $(go env GOPATH)/src/github.com/segmentio/terraform-docs/bin/$(uname | tr '[:upp
|
||||
Stable binaries are also available on the [releases](https://github.com/segmentio/terraform-docs/releases) page. To install, download the binary for your platform from "Assets" and place this into your `$PATH`:
|
||||
|
||||
```bash
|
||||
curl -Lo ./terraform-docs https://github.com/segmentio/terraform-docs/releases/download/v0.8.0/terraform-docs-$(uname)-amd64
|
||||
curl -Lo ./terraform-docs https://github.com/segmentio/terraform-docs/releases/download/v0.8.0/terraform-docs-v0.8.0-$(uname | tr '[:upper:]' '[:lower:]')-amd64
|
||||
chmod +x ./terraform-docs
|
||||
mv ./terraform-docs /some-dir-in-your-PATH/terraform-docs
|
||||
```
|
||||
|
||||
@@ -42,7 +42,19 @@ if [ $(git describe --tags "v${RELEASE_VERSION}" 2>/dev/null) ]; then
|
||||
fi
|
||||
|
||||
PWD=$(cd $(dirname "$0") && pwd -P)
|
||||
CLOSEST_VERSION=$(git describe --tags --abbrev=0)
|
||||
|
||||
# get closest GA tag, ignore alpha, beta and rc tags
|
||||
function getClosestVersion() {
|
||||
for t in $(git tag --sort=-creatordate); do
|
||||
tag="$t"
|
||||
if [[ $tag == *"-alpha"* || $tag == *"-beta"* || $tag == *"-rc"* ]]; then
|
||||
continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
echo "$tag"
|
||||
}
|
||||
CLOSEST_VERSION=$(getClosestVersion)
|
||||
|
||||
# Bump the released version in README and version.go
|
||||
sed -i -E 's|'${CLOSEST_VERSION}'|v'${RELEASE_VERSION}'|g' README.md
|
||||
@@ -57,7 +69,7 @@ printf "\033[36m==> %s\033[0m\n" "Push commits for v${RELEASE_VERSION}"
|
||||
git push origin master
|
||||
|
||||
# Generate Changelog
|
||||
make --no-print-directory -f ${PWD}/../../Makefile changelog next="--next-tag v${RELEASE_VERSION}"
|
||||
make --no-print-directory -f ${PWD}/../../Makefile changelog NEXT="--next-tag v${RELEASE_VERSION}"
|
||||
|
||||
# Tag the release
|
||||
printf "\033[36m==> %s\033[0m\n" "Tag release v${RELEASE_VERSION}"
|
||||
|
||||
Reference in New Issue
Block a user