Implement automatic Github releases

I hope this will create a git tag and upload a release for us.
This commit is contained in:
roschaefer 2019-09-13 02:08:48 +02:00
parent 8fa794f282
commit 1273d5f2b5
4 changed files with 29 additions and 0 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ cypress.env.json
!.gitkeep
**/coverage
release/

View File

@ -62,6 +62,7 @@ after_failure:
- ./send.sh failure $WEBHOOK_URL
before_deploy:
- go get -u github.com/tcnksm/ghr
- ./scripts/setup_kubernetes.sh
deploy:
@ -73,3 +74,7 @@ deploy:
script: scripts/deploy.sh
on:
branch: master
- provider: script
script: scripts/github_release.sh
on:
branch: master

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.1.0

22
scripts/github_release.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
ROOT_DIR=$(dirname "$0")/..
RELEASE_DIR="${ROOT_DIR}/release"
VERSION=$(<$ROOT_DIR/VERSION)
mkdir -p $RELEASE_DIR
# The following command part produces 854M on my machine
# apps=(nitro-web nitro-backend neo4j maintenance-worker maintenance)
# for app in "${apps[@]}"
# do
# docker image save "humanconnection/${app}:latest" | gzip > "${RELEASE_DIR}/${app}.${VERSION}.tar.gz"
# done
# Use something smaller instead
git archive --format tar HEAD:backend | gzip > "${RELEASE_DIR}/backend.${VERSION}.tar.gz"
git archive --format tar HEAD:webapp | gzip > "${RELEASE_DIR}/webapp.${VERSION}.tar.gz"
git archive --format zip HEAD:backend > "${RELEASE_DIR}/backend.${VERSION}.zip"
git archive --format zip HEAD:webapp > "${RELEASE_DIR}/webapp.${VERSION}.zip"
ghr -soft "${VERSION}" "${RELEASE_DIR}"