Add develop branch releases and display version tag (#216)

* Add releases for develop branch. Show version tag

* Pass version tag to cross-compile
This commit is contained in:
WithoutPants 2019-11-18 08:41:08 +11:00 committed by Leopere
parent 6dcb270471
commit 5963844191
7 changed files with 36 additions and 13 deletions

View file

@ -18,9 +18,11 @@ script:
#- make vet #- make vet
- go test -mod=vendor - go test -mod=vendor
before_deploy: before_deploy:
- if [ "$TRAVIS_BRANCH" = "develop"]; then export TAG_SUFFIX="_dev; fi
- export STASH_VERSION="v0.0.0-alpha${TAG_SUFFIX}""
- docker pull stashappdev/compiler - docker pull stashappdev/compiler
- sh ./scripts/cross-compile.sh - sh ./scripts/cross-compile.sh ${STASH_VERSION}
- git tag -f v0.0.0-alpha - git tag -f ${STASH_VERSION}
- git push -f --tags - git push -f --tags
- export RELEASE_DATE=$(date +'%Y-%m-%d %H:%M:%S %Z') - export RELEASE_DATE=$(date +'%Y-%m-%d %H:%M:%S %Z')
deploy: deploy:
@ -37,7 +39,8 @@ deploy:
body: ${RELEASE_DATE} body: ${RELEASE_DATE}
on: on:
repo: stashapp/stash repo: stashapp/stash
branch: master all_branches: true
condition: $TRAVIS_BRANCH =~ ^(master|develop)$
branches: branches:
only: only:
- master - master

View file

@ -61,7 +61,8 @@ query Logs {
} }
query Version { query Version {
version { version {
hash, version
hash
build_time build_time
} }
} }

View file

@ -1,4 +1,5 @@
type Version { type Version {
version: String
hash: String! hash: String!
build_time: String! build_time: String!
} }

View file

@ -108,9 +108,10 @@ func (r *queryResolver) Stats(ctx context.Context) (*models.StatsResultType, err
} }
func (r *queryResolver) Version(ctx context.Context) (*models.Version, error) { func (r *queryResolver) Version(ctx context.Context) (*models.Version, error) {
hash, buildtime := GetVersion() version, hash, buildtime := GetVersion()
return &models.Version{ return &models.Version{
Version: &version,
Hash: hash, Hash: hash,
BuildTime: buildtime, BuildTime: buildtime,
}, nil }, nil

View file

@ -27,6 +27,7 @@ import (
"github.com/stashapp/stash/pkg/utils" "github.com/stashapp/stash/pkg/utils"
) )
var version string = ""
var buildstamp string = "" var buildstamp string = ""
var githash string = "" var githash string = ""
@ -224,11 +225,15 @@ func Start() {
} }
func printVersion() { func printVersion() {
fmt.Printf("stash version: %s (%s)\n", githash, buildstamp) versionString := githash
if version != "" {
versionString = version + " (" + versionString + ")"
}
fmt.Printf("stash version: %s - %s\n", versionString, buildstamp)
} }
func GetVersion() (string, string) { func GetVersion() (string, string, string) {
return githash, buildstamp return version, githash, buildstamp
} }
func makeTLSConfig() *tls.Config { func makeTLSConfig() *tls.Config {

View file

@ -1,9 +1,10 @@
#!/bin/sh #!/bin/sh
STASH_VERSION="$1"
DATE=`go run -mod=vendor scripts/getDate.go` DATE=`go run -mod=vendor scripts/getDate.go`
GITHASH=`git rev-parse --short HEAD` GITHASH=`git rev-parse --short HEAD`
VERSION_FLAGS="-X 'github.com/stashapp/stash/pkg/api.buildstamp=$DATE' -X 'github.com/stashapp/stash/pkg/api.githash=$GITHASH'" VERSION_FLAGS="-X 'github.com/stashapp/stash/pkg/api.version=$STASH_VERSION' -X 'github.com/stashapp/stash/pkg/api.buildstamp=$DATE' -X 'github.com/stashapp/stash/pkg/api.githash=$GITHASH'"
SETUP="export GO111MODULE=on; export CGO_ENABLED=1;" SETUP="export GO111MODULE=on; export CGO_ENABLED=1;"
WINDOWS="GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ packr2 build -o dist/stash-win.exe -ldflags \"-extldflags '-static' $VERSION_FLAGS\" -tags extended -v -mod=vendor;" WINDOWS="GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ packr2 build -o dist/stash-win.exe -ldflags \"-extldflags '-static' $VERSION_FLAGS\" -tags extended -v -mod=vendor;"
DARWIN="GOOS=darwin GOARCH=amd64 CC=o64-clang CXX=o64-clang++ packr2 build -o dist/stash-osx -ldflags \"$VERSION_FLAGS\" -tags extended -v -mod=vendor;" DARWIN="GOOS=darwin GOARCH=amd64 CC=o64-clang CXX=o64-clang++ packr2 build -o dist/stash-osx -ldflags \"$VERSION_FLAGS\" -tags extended -v -mod=vendor;"

View file

@ -16,12 +16,23 @@ interface IProps {}
export const SettingsAboutPanel: FunctionComponent<IProps> = (props: IProps) => { export const SettingsAboutPanel: FunctionComponent<IProps> = (props: IProps) => {
const { data, error, loading } = StashService.useVersion(); const { data, error, loading } = StashService.useVersion();
function maybeRenderTag() {
if (!data || !data.version || !data.version.version) { return; }
return (
<tr>
<td>Version:</td>
<td>{data.version.version}</td>
</tr>
);
}
function renderVersion() { function renderVersion() {
if (!data || !data.version) { return; } if (!data || !data.version) { return; }
return ( return (
<> <>
<HTMLTable> <HTMLTable>
<tbody> <tbody>
{maybeRenderTag()}
<tr> <tr>
<td>Build hash:</td> <td>Build hash:</td>
<td>{data.version.hash}</td> <td>{data.version.hash}</td>