-
Notifications
You must be signed in to change notification settings - Fork 16
192 lines (157 loc) · 5.25 KB
/
release-zwalletcli.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: RELEASE_ZWALLETCLI
concurrency:
group: "release-${{ github.ref }}"
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
fixed_tag:
description: 'Type yes For Building With Tag v0.0.0 from master & v1.1.1 from staging'
default: 'no'
required: true
version_tag:
description: 'Input major or miner for release type. Default is patch'
default: 'patch'
required: true
env:
GITHUB_TOKEN: ${{ secrets.GOSDK }}
jobs:
build-linux:
name: Build-Linux
runs-on: [self-hosted, arc-runner]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup go 1.21
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install
run: make install
- name: Get Branch
id: get_version
run: |
VERSION=$(echo ${GITHUB_REF#refs/heads/})
echo ::set-output name=TAG::${VERSION}
- name: Zip release
run: tar -czvf zwallet-linux.tar.gz ./zwallet
############################### v1.1.1 #############################
- name: Delete Old Release & Tag v1.1.1
if: github.event.inputs.fixed_tag == 'yes' && steps.get_version.outputs.TAG == 'staging'
uses: dev-drprasad/[email protected]
with:
delete_release: true # default: false
tag_name: v1.1.1 # tag name to delete
repo: 0chain/zwalletcli # target repo (optional). defaults to repo running this action
- name: Create Release for Fixed v1.1.1
if: github.event.inputs.fixed_tag == 'yes' && steps.get_version.outputs.TAG == 'staging'
uses: zendesk/action-create-release@v1
with:
tag_name: v1.1.1
release_name: v1.1.1
draft: false
prerelease: false
############################### v0.0.0 #############################
- name: Delete Old Release & Tag v0.0.0
if: github.event.inputs.fixed_tag == 'yes' && steps.get_version.outputs.TAG == 'master'
uses: dev-drprasad/[email protected]
with:
delete_release: true # default: false
tag_name: v0.0.0 # tag name to delete
repo: 0chain/zwalletcli # target repo (optional). defaults to repo running this action
- name: Create Release for Fixed v0.0.0
if: github.event.inputs.fixed_tag == 'yes' && steps.get_version.outputs.TAG == 'master'
uses: zendesk/action-create-release@v1
with:
tag_name: v0.0.0
release_name: v0.0.0
draft: false
prerelease: false
############################### v*.*.* #############################
- name: Create Release for Next Version
id: create_release_next_version
uses: zendesk/action-create-release@v1
with:
draft: false
prerelease: false
auto_increment_type: ${{ github.event.inputs.version_tag }}
tag_schema: semantic
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: zwallet-linux
path: zwallet
retention-days: 5
build-windows:
name: Build-windows
runs-on: windows-runner
defaults:
run:
shell: msys2 {0}
strategy:
matrix:
sys: [ MINGW64 ]
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
- name: Install libraries
run: |
echo 'Y'| pacman -S base-devel git gcc make
- name: Install Clang and Go for MINGW64
run: |
echo 'y'| pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-go zip unzip
- name: Set environment variables
run: |
export GOROOT=/mingw64/lib/go
export GOPATH=/mingw64
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:/usr/bin/7z
# use clang as a default compiler for CGO
go env -w "CC=/mingw64/bin/clang.exe"
- name: Checkout
uses: actions/checkout@v2
- name: Install
run: make install
- name: Zip release
run: |
# download dll files
wget https://github.com/0chain/zboxcli/files/11840033/windows.dll.s.zip
unzip -o windows.dll.s.zip
cp zwallet zwallet.exe
zip zwallet-windows.zip zwallet.exe libgcc_s_seh-1.dll libstdc++-6.dll libwinpthread-1.dll
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: zwallet-windows.zip
path: zwallet-windows.zip
retention-days: 5
- name: cleanup workspace
run: |
rm -Recurse ${{github.workspace}}\*
shell: powershell
build-macos:
name: Build-MacOS
runs-on: macos-runner
steps:
- name: Setup go 1.21
uses: actions/setup-go@v5
with:
go-version: '1.21' # The Go version to download (if necessary) and use.
- name: Checkout
uses: actions/checkout@v2
- name: Install
run: make install
- name: Get Branch
id: get_version
run: |
VERSION=$(echo ${GITHUB_REF#refs/heads/})
echo ::set-output name=TAG::${VERSION}
- name: Zip release
run: tar -czvf zwallet-macos.tar.gz ./zwallet
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: zwallet-macos
path: zwallet
retention-days: 5