mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
Task: Add release process
This commit is contained in:
parent
9d1a5b17b8
commit
a00e6c5316
4
Makefile
4
Makefile
@ -107,6 +107,10 @@ build-docs: prepare mkdocs.yml mkdocs/*
|
||||
@find docs -type d -exec chmod 755 {} \; || :
|
||||
@find docs -type f -exec chmod 644 {} \; || :
|
||||
|
||||
.PHONY: release
|
||||
release: xcompile
|
||||
${DOCKRUN} bash ./scripts/publish.sh
|
||||
|
||||
# ----------------------------------------------
|
||||
# utilities
|
||||
|
||||
|
@ -8,6 +8,8 @@ LDFLAGS :=
|
||||
LDFLAGS += -X main.GitCommit=${GIT_COMMIT}${GIT_DIRTY}
|
||||
LDFLAGS += -X main.GitDescribe=${GIT_DESCRIBE}
|
||||
|
||||
GITHUB_TOKEN ?=
|
||||
|
||||
# Windows environment?
|
||||
CYG_CHECK := $(shell hash cygpath 2>/dev/null && echo 1)
|
||||
ifeq ($(CYG_CHECK),1)
|
||||
@ -29,6 +31,7 @@ DEV_IMAGE := ${PROJECT}_dev
|
||||
|
||||
DOCKRUN := docker run --rm \
|
||||
-e LDFLAGS="${LDFLAGS}" \
|
||||
-e GITHUB_TOKEN="${GITHUB_TOKEN}" \
|
||||
-v ${ROOT}/vendor:/go/src \
|
||||
-v ${ROOT}:/${PROJECT}/src/${IMPORT_PATH} \
|
||||
-w /${PROJECT}/src/${IMPORT_PATH} \
|
||||
|
@ -4,6 +4,7 @@ go get -u github.com/alecthomas/gometalinter
|
||||
go get -u golang.org/x/tools/cmd/goimports
|
||||
go get -u github.com/mitchellh/gox
|
||||
go get -u github.com/kardianos/govendor
|
||||
go get -u github.com/aktau/github-release
|
||||
|
||||
# install all the linters
|
||||
gometalinter --install --update
|
||||
|
40
scripts/publish.sh
Executable file
40
scripts/publish.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}"
|
||||
|
||||
CURRENT="$(git describe --tags --abbrev=0)"
|
||||
PREVIOUS="$(git describe --tags --abbrev=0 --always "${CURRENT}"^)"
|
||||
OWNER="mikefarah"
|
||||
REPO="yaml"
|
||||
|
||||
release() {
|
||||
mapfile -t logs < <(git log --pretty=oneline --abbrev-commit "${PREVIOUS}".."${CURRENT}")
|
||||
description="$(printf '%s\n' "${logs[@]}")"
|
||||
github-release release \
|
||||
--user "$OWNER" \
|
||||
--repo "$REPO" \
|
||||
--tag "$CURRENT" \
|
||||
--description "$description" ||
|
||||
github-release edit \
|
||||
--user "$OWNER" \
|
||||
--repo "$REPO" \
|
||||
--tag "$CURRENT" \
|
||||
--description "$description"
|
||||
}
|
||||
|
||||
upload() {
|
||||
mapfile -t files < <(find ./build -mindepth 1 -maxdepth 1)
|
||||
for file in "${files[@]}"; do
|
||||
BINARY=$(basename "${file}")
|
||||
echo "--> ${BINARY}"
|
||||
github-release upload \
|
||||
--user "$OWNER" \
|
||||
--repo "$REPO" \
|
||||
--tag "$CURRENT" \
|
||||
--name "${BINARY}" \
|
||||
--file "$file"
|
||||
done
|
||||
}
|
||||
|
||||
release
|
||||
upload
|
Loading…
Reference in New Issue
Block a user