1
+ name : build-cli
2
+ on :
3
+ push :
4
+ branches :
5
+ - master
6
+ - dev
7
+ tags :
8
+ - ' v*.*.*'
9
+
10
+ pull_request :
11
+ branches :
12
+ - master
13
+ - production
14
+ jobs :
15
+ build-linux :
16
+ name : Build-linux
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+
20
+ - name : Checkout
21
+ uses : actions/checkout@v2
22
+
23
+ - name : Set GITHUB_ENV
24
+ run : |
25
+ echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
26
+
27
+ if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
28
+ echo "TAG=v0.0.0-master" >> $GITHUB_ENV
29
+ elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
30
+ echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
31
+ else
32
+ echo "TAG=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g' )" >> $GITHUB_ENV
33
+ fi
34
+
35
+ - name : Install
36
+ run : make install
37
+
38
+ - name : zip release
39
+ run : tar -czvf zbox-linux.tar.gz ./zbox
40
+
41
+ - name : Upload binaries to release
42
+ uses : svenstaro/upload-release-action@v2
43
+ with :
44
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
45
+ file : zbox-linux.tar.gz
46
+ tag : ${{ env.TAG }}
47
+ overwrite : true
48
+ file_glob : true
49
+
50
+ - name : ' Upload Artifact'
51
+ uses : actions/upload-artifact@v2
52
+ with :
53
+ name : zbox-linux
54
+ path : zbox
55
+ retention-days : 5
56
+ build-windows :
57
+ name : Build-windows
58
+ runs-on : windows-latest
59
+ steps :
60
+
61
+ - name : Checkout
62
+ uses : actions/checkout@v2
63
+
64
+ - name : Set GITHUB_ENV
65
+ run : |
66
+ echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
67
+
68
+ if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
69
+ echo "TAG=v0.0.0-master" >> $GITHUB_ENV
70
+ elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
71
+ echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
72
+ else
73
+ echo "TAG=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g' )" >> $GITHUB_ENV
74
+ fi
75
+
76
+ - name : Install
77
+ run : make install
78
+
79
+ - name : zip release
80
+ run : |
81
+ copy zbox zbox.exe
82
+ 7z a zbox-windows.zip zbox.exe
83
+
84
+ - name : Upload binaries to release
85
+ uses : svenstaro/upload-release-action@v2
86
+ with :
87
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
88
+ file : zbox-windows.zip
89
+ tag : ${{ env.TAG }}
90
+ overwrite : true
91
+ file_glob : true
92
+
93
+ - name : ' Upload Artifact'
94
+ uses : actions/upload-artifact@v2
95
+ with :
96
+ name : zbox-windows
97
+ path : zbox
98
+ retention-days : 5
99
+ build-macos :
100
+ name : Build-macos
101
+ runs-on : macos-latest
102
+ steps :
103
+
104
+ - name : Checkout
105
+ uses : actions/checkout@v2
106
+
107
+ - name : Set GITHUB_ENV
108
+ run : |
109
+ echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
110
+
111
+ if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
112
+ echo "TAG=v0.0.0-master" >> $GITHUB_ENV
113
+ elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
114
+ echo "TAG=v0.0.0-dev" >> $GITHUB_ENV
115
+ else
116
+ echo "TAG=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g' )" >> $GITHUB_ENV
117
+ fi
118
+
119
+ - name : Install
120
+ run : make install
121
+ - name : zip release
122
+ run : tar -czvf zbox-macos.tar.gz ./zbox
123
+
124
+ - name : Upload binaries to release
125
+ uses : svenstaro/upload-release-action@v2
126
+ with :
127
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
128
+ file : zbox-macos.tar.gz
129
+ tag : ${{ env.TAG }}
130
+ overwrite : true
131
+ file_glob : true
132
+
133
+ - name : ' Upload Artifact'
134
+ uses : actions/upload-artifact@v2
135
+ with :
136
+ name : zbox-macos
137
+ path : zbox
138
+ retention-days : 5
0 commit comments