Automate github releases (#1263)

This commit is contained in:
Andrea Maria Piana 2018-11-05 15:02:16 +01:00 committed by GitHub
parent 0961e1039e
commit 58bd36e79e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 27 deletions

View File

@ -1,6 +1,11 @@
.PHONY: statusgo statusd-prune all test xgo clean help
.PHONY: statusgo-android statusgo-ios
RELEASE_TAG := $(shell cat VERSION)
RELEASE_BRANCH := "develop"
RELEASE_DIRECTORY := /tmp/release-$(RELEASE_TAG)
PRE_RELEASE := "1"
help: ##@other Show this help
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
@ -201,12 +206,33 @@ xgo:
install-os-dependencies:
_assets/scripts/install_deps.sh
setup: install-os-dependencies dep-install lint-install mock-install gen-install update-fleet-config ##@other Prepare project for first build
setup: install-os-dependencies dep-install lint-install mock-install deploy-install gen-install update-fleet-config ##@other Prepare project for first build
generate: ##@other Regenerate assets and other auto-generated stuff
go generate ./static ./static/migrations
$(shell cd ./services/shhext/chat && exec protoc --go_out=. ./*.proto)
prepare-release: clean-release
mkdir -p $(RELEASE_DIRECTORY)
mv build/bin/statusgo-android-16.aar $(RELEASE_DIRECTORY)/status-go-android.aar
mv build/bin/statusgo-ios-9.3-framework/status-go-ios.zip $(RELEASE_DIRECTORY)/status-go-ios.zip
${MAKE} clean
zip -r $(RELEASE_DIRECTORY)/status-go-desktop.zip . -x *.git*
clean-release:
rm -rf $(RELEASE_DIRECTORY)
release:
@read -p "Are you sure you want to create a new GitHub $(shell if [[ $(PRE_RELEASE) = "0" ]] ; then echo release; else echo pre-release ; fi) against $(RELEASE_BRANCH) branch? (y/n): " REPLY; \
if [ $$REPLY = "y" ]; then \
github-release $(shell if [[ $(PRE_RELEASE) != "0" ]] ; then echo "-prerelease" ; fi) "status-im/status-go" "$(RELEASE_TAG)" "$(RELEASE_BRANCH)" "" "$(RELEASE_DIRECTORY)/*" ; \
else \
echo "Aborting." && exit 1; \
fi
deploy-install:
go get -u github.com/c4milo/github-release
gen-install:
go get -u github.com/jteeuwen/go-bindata/...
go get -u github.com/golang/protobuf/protoc-gen-go

View File

@ -11,3 +11,20 @@
# License
[Mozilla Public License 2.0](https://github.com/status-im/status-go/blob/develop/LICENSE.md)
### Releasing
To create a release, first increase the `VERSION` file according to semantic versioning.
You can then build the artifacts for the specific platform.
Once done, you can run:
`make prepare-release`
and
`make release release_branch={{release_branch}}`
Where `release_branch` is the branch you are targeting.
You will also need to specify some form of credentials, `GITHUB_TOKEN` environment variable for example.

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.16.5

View File

@ -71,32 +71,18 @@ node('linux') {
stage('Deploy') {
dir(cloneDir) {
// For branch builds, replace the old artifact. For develop keep all of them.
def version = sh(
script: "git describe --exact-match --tag 2>/dev/null || git describe --always",
returnStdout: true
).trim()
def server = Artifactory.server 'artifacts'
def uploadSpec = """{
"files": [
{
"pattern": "build/bin/statusgo-android-16.aar",
"target": "libs-release-local/status-im/status-go/${version}/status-go-${version}.aar"
},
{
"pattern": "build/bin/statusgo-ios-9.3-framework/status-go-ios.zip",
"target": "libs-release-local/status-im/status-go-ios-simulator/${version}/status-go-ios-simulator-${version}.zip"
}
]
}"""
def buildInfo = Artifactory.newBuildInfo()
buildInfo.env.capture = false
buildInfo.name = 'status-go (' + gitBranch + '-' + gitShortSHA + ')'
server.upload(uploadSpec, buildInfo)
server.publishBuildInfo(buildInfo)
slackSend color: 'good', message: 'status-go `' + version + '` was built successfully. ' + env.BUILD_URL
sh "make prepare-release"
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'status-im-auto',
usernameVariable: 'GITHUB_USER',
passwordVariable: 'GITHUB_TOKEN'
]]) {
sh """
yes | make release release_branch=${gitBranch}
"""
}
sh "make clean-release"
}
}
}