first commit
This commit is contained in:
85
development/release-target.yaml
Normal file
85
development/release-target.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
# yaml-language-server: $schema=https://git.jesof.ch/public/mstr-schemas/raw/branch/main/mstr-tasks-schema.json
|
||||
tasks:
|
||||
- set:
|
||||
description: "Set default destination dir"
|
||||
variables:
|
||||
- varName: destDir
|
||||
value: "$(tempdir())/$(target.buildGoos)-$(target.buildGoarch)"
|
||||
|
||||
- execute:
|
||||
description: "Create destination dir"
|
||||
exec: "mkdir"
|
||||
args:
|
||||
- "-p"
|
||||
- "$(destDir)"
|
||||
|
||||
- execute:
|
||||
description: "Build $(target.buildGoos)-$(target.buildGoarch)"
|
||||
exec: "go"
|
||||
dir: "cmd/$(name)"
|
||||
env:
|
||||
GOOS: "$(target.buildGoos)"
|
||||
GOARCH: "$(target.buildGoarch)"
|
||||
args:
|
||||
- "build"
|
||||
- "-o"
|
||||
- "$(destDir)/$(name)"
|
||||
- "-ldflags"
|
||||
- "-X main.Version=$(version) -X main.Githash=$(githash) -s -w"
|
||||
|
||||
- tar:
|
||||
description: "Compress binary with tar"
|
||||
source: "$(destDir)/$(name)"
|
||||
archiveFile: "$(destDir)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).tar.gz"
|
||||
gzip: true
|
||||
|
||||
- sha256:
|
||||
description: "Compute checksum from tar file"
|
||||
file: "$(destDir)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).tar.gz"
|
||||
varName: "checksum"
|
||||
|
||||
- write:
|
||||
description: "Save checksum to ...sha256 file"
|
||||
format: "$(checksum)"
|
||||
file: "$(destDir)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).sha256"
|
||||
|
||||
- execute:
|
||||
description: "Upload Tar File"
|
||||
exec: "curl"
|
||||
args:
|
||||
- "-sS"
|
||||
- "-X"
|
||||
- "POST"
|
||||
- "-H"
|
||||
- "Authorization: token $(decrypt(gitToken,keyfile))"
|
||||
- "-H"
|
||||
- "Content-Type: application/octet-stream"
|
||||
- "--data-binary"
|
||||
- "@$(destDir)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).tar.gz"
|
||||
- "@(git)/api/v1/repos/golang/$(name)/releases/$(releaseId)/assets?name=$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).tar.gz"
|
||||
|
||||
- execute:
|
||||
description: "Upload Checksum File"
|
||||
exec: "curl"
|
||||
args:
|
||||
- "-sS"
|
||||
- "-X"
|
||||
- "POST"
|
||||
- "-H"
|
||||
- "Authorization: token $(decrypt(gitToken,keyfile))"
|
||||
- "-H"
|
||||
- "Content-Type: application/octet-stream"
|
||||
- "--data-binary"
|
||||
- "@$(destDir)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).sha256"
|
||||
- "@(git)/api/v1/repos/golang/$(name)/releases/$(releaseId)/assets?name=$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).sha256"
|
||||
|
||||
- execute:
|
||||
description: "Install binary"
|
||||
stdin: "$(decrypt(unixPassword,keyfile))"
|
||||
exec: "sudo"
|
||||
args:
|
||||
- "--stdin"
|
||||
- "cp"
|
||||
- "$(tempdir())/$(GOOS)-$(GOARCH)/$(name)"
|
||||
- "$(installPath)"
|
||||
when: $(installPath != nil && target.buildGoos == GOOS && target.buildGoarch == GOARCH)
|
||||
Reference in New Issue
Block a user