Skip to content

Commit 2c635a5

Browse files
committed
add ADO pipeline
1 parent 38b59c4 commit 2c635a5

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

azure-pipelines.yml

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

0 commit comments

Comments
 (0)