-
Notifications
You must be signed in to change notification settings - Fork 40
158 lines (141 loc) · 5.33 KB
/
release.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Upload Release Asset
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get the target release version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: go version
- name: Build
run: |
mkdir -p bin
VERSION=${{ steps.get_version.outputs.VERSION }}
STATIC_FLAG='-w -extldflags "-static"'
for platform in darwin/amd64 darwin/arm64 linux/amd64 linux/ppc64le windows/amd64
do
os_name=$(echo "$platform" | cut -d "/" -f 1)
arch=$(echo "$platform" | cut -d "/" -f 2)
CGO_ENABLED=0 GOOS=${os_name} GOARCH=${arch} go build -a -tags netgo -ldflags "-X github.com/ppc64le-cloud/pvsadm/pkg/version.Version=${VERSION} ${STATIC_FLAG}" -o bin/${os_name}-${arch}/pvsadm .
tar -czvf pvsadm-${os_name}-${arch}.tar.gz -C bin/${os_name}-${arch} pvsadm
done
tar -czvf pvsadm-binaries.tar.gz bin/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
draft: true
prerelease: true
- name: Upload linux - amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/linux-amd64/pvsadm
asset_name: pvsadm-linux-amd64
asset_content_type: application/octet-stream
- name: Upload linux - amd64 - tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pvsadm-linux-amd64.tar.gz
asset_name: pvsadm-linux-amd64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload linux - ppc64le
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/linux-ppc64le/pvsadm
asset_name: pvsadm-linux-ppc64le
asset_content_type: application/octet-stream
- name: Upload linux - ppc64le - tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pvsadm-linux-ppc64le.tar.gz
asset_name: pvsadm-linux-ppc64le.tar.gz
asset_content_type: application/tar+gzip
- name: Upload darwin/amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/darwin-amd64/pvsadm
asset_name: pvsadm-darwin-amd64
asset_content_type: application/octet-stream
- name: Upload darwin/amd64 - tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pvsadm-darwin-amd64.tar.gz
asset_name: pvsadm-darwin-amd64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload darwin/arm64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/darwin-arm64/pvsadm
asset_name: pvsadm-darwin-arm64
asset_content_type: application/octet-stream
- name: Upload darwin/arm64 - tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pvsadm-darwin-arm64.tar.gz
asset_name: pvsadm-darwin-arm64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload Windows - amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/windows-amd64/pvsadm
asset_name: pvsadm-windows-amd64
asset_content_type: application/octet-stream
- name: Upload Windows - amd64 - tar.gz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pvsadm-windows-amd64.tar.gz
asset_name: pvsadm-windows-amd64.tar.gz
asset_content_type: application/tar+gzip
- name: Upload all
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: pvsadm-binaries.tar.gz
asset_name: pvsadm-binaries.tar.gz
asset_content_type: application/tar+gzip