Skip to content
Snippets Groups Projects
Verified Commit 76743c2f authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: test gorelease

parent ea34d8fa
No related branches found
No related tags found
No related merge requests found
...@@ -16,9 +16,31 @@ variables: ...@@ -16,9 +16,31 @@ variables:
stages: stages:
# - build # - build
# - deploy - tag
- release - release
tag-it:
stage: tag
script:
- git config user.email "''${GITLAB_USER_EMAIL}"
- git config user.name "''${GITLAB_USER_NAME:-"Gitlab CI"}"
- git config credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=''${CI_JOB_TOKEN}"; }; f'
- git config pull.rebase true
- git config http.sslVerify "false"
- git remote set-url origin https://pad:''${GITLAB_TOKEN}@''${CI_REPOSITORY_URL#*@}
- git fetch --all --tags --unshallow
- git reset --hard origin/master
- git checkout $CI_COMMIT_REF_NAME
- git pull origin $CI_COMMIT_REF_NAME
- version auto exit-code-if-no-bump
- git push origin $CI_COMMIT_REF_NAME
only:
## regex to x.y branches and master
- master
except:
- tags
release: release:
stage: release stage: release
image: image:
...@@ -28,7 +50,6 @@ release: ...@@ -28,7 +50,6 @@ release:
- tags - tags
variables: variables:
# Disable shallow cloning so that goreleaser can diff between tags to # Disable shallow cloning so that goreleaser can diff between tags to
# generate a changelog.
GIT_DEPTH: 0 GIT_DEPTH: 0
script: script:
- cd source; goreleaser release --clean - cd source; goreleaser release --clean
......
/nix/store/nil8y275ifgp8i2psgfi5ls53qmhihsn-goreleaser.yml /nix/store/69q2b7irlnvf3cpf80gq07nm3mn6yf9r-goreleaser.yml
\ No newline at end of file \ No newline at end of file
...@@ -43,7 +43,7 @@ tasks: ...@@ -43,7 +43,7 @@ tasks:
text = '' text = ''
# .goreleaser.yml # .goreleaser.yml
gitlab_urls: gitlab_urls:
api: https://gitlab.schukai.com/api/v4/ api: https://gitlab.schukai.com/api/v4
download: https://gitlab.schukai.com download: https://gitlab.schukai.com
# set to true if you use a self-signed certificate # set to true if you use a self-signed certificate
...@@ -55,9 +55,43 @@ gitlab_urls: ...@@ -55,9 +55,43 @@ gitlab_urls:
# Since: v1.11 # Since: v1.11
use_job_token: false use_job_token: false
project_name: version project_name: version
builds:
- id: version
goos:
- linux
# - darwin
# - windows
goarch:
- amd64
# - arm64
# - "386"
goarm:
- "6"
# gomips:
# - hardfloat
# goamd64:
# - v1
targets:
# - linux_amd64_v1
- linux_arm64
# - linux_386
# - darwin_amd64_v1
# - darwin_arm64
# - windows_amd64_v1
# - windows_arm64
# - windows_386
dir: source
#main: source/main.go
# binary: version
# builder: go
# gobinary: go
# command: build
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.build={{.Date}}
''; '';
}; };
......
...@@ -111,7 +111,11 @@ func executeCommand() { ...@@ -111,7 +111,11 @@ func executeCommand() {
} }
if command == "version" { if command == "version" {
fmt.Println(GetMnemonic() + " " + GetVersion() + " (" + GetBuild() + ")") fmt.Println("Name: ", GetName())
fmt.Println("Version: ", GetVersion())
fmt.Println("Build: ", GetBuild())
fmt.Println("Commit: ", GetCommit())
fmt.Println("Mnemonic: ", GetMnemonic())
return return
} }
......
...@@ -6,18 +6,24 @@ var ( ...@@ -6,18 +6,24 @@ var (
version = "dev" version = "dev"
build = "n/a" build = "n/a"
mnemonic = "version" mnemonic = "version"
name = "Version"
commit = "n/a"
) )
type Accessor interface { type Accessor interface {
GetVersion() string GetVersion() string
GetBuild() string GetBuild() string
GetMnemonic() string GetMnemonic() string
GetCommit() string
GetName() string
} }
type ReleaseStruct struct { type ReleaseStruct struct {
Version string Version string
Build string Build string
Mnemonic string Mnemonic string
Commit string
Name string
} }
var release ReleaseStruct var release ReleaseStruct
...@@ -28,6 +34,8 @@ func init() { ...@@ -28,6 +34,8 @@ func init() {
Version: version, Version: version,
Build: build, Build: build,
Mnemonic: mnemonic, Mnemonic: mnemonic,
Commit: commit,
Name: name,
} }
} }
...@@ -42,3 +50,11 @@ func GetBuild() string { ...@@ -42,3 +50,11 @@ func GetBuild() string {
func GetMnemonic() string { func GetMnemonic() string {
return release.Mnemonic return release.Mnemonic
} }
func GetCommit() string {
return release.Commit
}
func GetName() string {
return release.Name
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment