scripts,Jenkinsfile,Makefile: upload binaries to drafted github release
This change adds a script and the needed build logic to create a draft github release and then upload the created binaries to it in order to make the actual publishing a lot less error prone. The logic is currently that it only does this for all github tags, but not for every main build/push. This is handled by the checks in the script itself. Change-Id: Ie172a8e4a97200de901a26a055aa5a8a54b60a2a
This commit is contained in:
parent
db7985ca90
commit
e2481fb510
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -135,6 +135,14 @@ node('node') {
|
|||||||
|
|
||||||
echo "Current build result: ${currentBuild.result}"
|
echo "Current build result: ${currentBuild.result}"
|
||||||
}
|
}
|
||||||
|
stage('Draft Release') {
|
||||||
|
withCredentials([string(credentialsId: 'GITHUB_RELEASE_TOKEN', variable: 'GITHUB_TOKEN')]) {
|
||||||
|
lastStage = env.STAGE_NAME
|
||||||
|
sh 'make draft-release'
|
||||||
|
|
||||||
|
echo "Current build result: ${currentBuild.result}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
5
Makefile
5
Makefile
@ -46,6 +46,7 @@ build-dev-deps: ## Install dependencies for builds
|
|||||||
go get golang.org/x/tools/cover
|
go get golang.org/x/tools/cover
|
||||||
go get github.com/go-bindata/go-bindata/go-bindata
|
go get github.com/go-bindata/go-bindata/go-bindata
|
||||||
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
|
go get github.com/josephspurrier/goversioninfo/cmd/goversioninfo
|
||||||
|
go get github.com/github-release/github-release
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: ## Analyze and find programs in source code
|
lint: ## Analyze and find programs in source code
|
||||||
@ -370,6 +371,10 @@ binaries-upload: ## Upload binaries to Google Storage (jenkins)
|
|||||||
; done
|
; done
|
||||||
cd "release/${TAG}"; gsutil -m cp -r *.zip "gs://storj-v3-alpha-builds/${TAG}/"
|
cd "release/${TAG}"; gsutil -m cp -r *.zip "gs://storj-v3-alpha-builds/${TAG}/"
|
||||||
|
|
||||||
|
.PHONY: draft-release
|
||||||
|
draft-release:
|
||||||
|
scripts/draft-release.sh ${BRANCHNAME} "release/${TAG}"
|
||||||
|
|
||||||
##@ Clean
|
##@ Clean
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
28
scripts/draft-release.sh
Executable file
28
scripts/draft-release.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# usage: $0 vMAJOR.MINOR.PATCH[-rc[-*]] PATH/TO/BINARIES
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
apps="identity uplink storagenode multinode"
|
||||||
|
|
||||||
|
TAG="${1-}"
|
||||||
|
|
||||||
|
if ! [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-rc+(-.*)?)?$ ]]; then
|
||||||
|
echo "No tag detected, skipping release drafting"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
FOLDER="${2-}"
|
||||||
|
|
||||||
|
echo "Drafting release"
|
||||||
|
github-release release --user storj --repo storj --tag "$TAG" --draft
|
||||||
|
|
||||||
|
echo "Uploading binaries to release draft"
|
||||||
|
for app in $apps;
|
||||||
|
do
|
||||||
|
for file in "$FOLDER/$app"*.zip
|
||||||
|
do
|
||||||
|
github-release upload --user storj --repo storj --tag "$TAG" --name $(basename "$file") --file "$file"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
echo "Drafting release done"
|
Loading…
Reference in New Issue
Block a user