forked from Azure/aztfexport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
70 lines (61 loc) · 1.63 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Go
# Build your Go project.
# Add steps that test, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/go
parameters:
- name: version
displayName: Release Version
type: string
jobs:
- job: Package
displayName: 'Package: '
pool:
vmImage: 'ubuntu-latest'
steps:
- task: GoTool@0
displayName: 'Install Go'
inputs:
version: 1.17.4
GOPATH: '$(Pipeline.Workspace)/gopath'
GOBIN: '$(GOPATH)/bin'
- bash: |
#!/usr/bin/env bash
OS_ARCH=("freebsd:amd64"
"freebsd:386"
"freebsd:arm"
"freebsd:arm64"
"windows:amd64"
"windows:386"
"linux:amd64"
"linux:386"
"linux:arm"
"linux:arm64"
"darwin:amd64"
"darwin:arm64")
mkdir dist
for os_arch in "${OS_ARCH[@]}" ; do
OS=${os_arch%%:*}
ARCH=${os_arch#*:}
echo "GOOS: ${OS}, GOARCH: ${ARCH}"
output=aztfy
if [[ $OS = windows ]]; then
output=aztfy.exe
fi
GOOS="${OS}" GOARCH="${ARCH}" CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o $output
pkg="aztfy_${VERSION}_${OS}_${ARCH}.zip"
zip $pkg $output
rm $output
mv $pkg dist
done
cd dist
checksum="aztfy_${VERSION}_SHA256SUMS"
shasum -a 256 * > $checksum
cp $checksum ${checksum}.sig
displayName: "Build Packages"
env:
VERSION: ${{ parameters.version }}
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(system.defaultWorkingDirectory)/dist/'
artifact: 'artifact'
publishLocation: 'pipeline'