1
0
Files
mstr-tasks/development/release-target.yaml
2026-01-27 10:17:58 +01:00

86 lines
2.7 KiB
YAML

# 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"
- "PUT"
- "-H"
- "Authorization: token $(decrypt(gitToken,keyfile))"
- "-H"
- "Content-Type: application/octet-stream"
- "--data-binary"
- "@$(destDir)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).tar.gz"
- "@(packages)/$(name)/$(version)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).tar.gz"
- execute:
description: "Upload Checksum File"
exec: "curl"
args:
- "-sS"
- "-X"
- "PUT"
- "-H"
- "Authorization: token $(decrypt(gitToken,keyfile))"
- "-H"
- "Content-Type: application/octet-stream"
- "--data-binary"
- "@$(destDir)/$(name)_$(version)_$(target.buildGoos)-$(target.buildGoarch).sha256"
- "@(packages)/$(name)/$(version)/$(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)