13
13
strategy :
14
14
matrix :
15
15
goos : [ linux ]
16
- goarch : [ arm64, 386, riscv64, mips64, mips64le, mipsle, mips ]
16
+ goarch : [ arm64, 386, riscv64, loong64, mips64, mips64le, mipsle, mips, ppc64, ppc64le, s390x ]
17
17
include :
18
18
# BEGIN Linux ARM 5 6 7
19
19
- goos : linux
@@ -91,55 +91,126 @@ jobs:
91
91
find ./go-mod/ -maxdepth 1 ! -name "cache" ! -name "go-mod" -exec rm -rf {} \;
92
92
sed -i 's/#export GOMODCACHE=$(PWD)\/go-mod/export GOMODCACHE=$(PWD)\/go-mod/' Makefile
93
93
94
- - name : Create full source ZIP archive and Signature
94
+ - name : Create directory for placing archives & packages temporarily
95
+ run : mkdir -p ./bundled/
96
+
97
+ - name : Create full source archive
95
98
if : matrix.goarch == 'arm64'
96
99
run : |
97
- zip -9vr dae-full-src.zip . -x .git/\*
98
- FILE=./dae-full-src.zip
99
- echo "$(md5sum $FILE)"" md5" >> $FILE.dgst
100
- echo "$(shasum -a 1 $FILE)"" sha1" >> $FILE.dgst
101
- echo "$(shasum -a 256 $FILE)"" sha256" >> $FILE.dgst
102
- echo "$(shasum -a 512 $FILE)"" sha512" >> $FILE.dgst
100
+ zip -9vr ./bundled/dae-full-src.zip . -x .git/\* bundled/\*
101
+ tar -I 'xz -9' -cvf ./bundled/dae-full-src.tar.xz --exclude .git --exclude bundled .
103
102
104
103
- name : Build dae
105
104
run : |
106
- mkdir -p ./build/
107
105
export CGO_ENABLED=0
108
106
export GOFLAGS="-trimpath -modcacherw"
109
- export OUTPUT=build/dae-$ASSET_NAME
110
- export VERSION=${{ steps.get_version.outputs .VERSION }}
107
+ export OUTPUT=build/usr/bin/ dae
108
+ export VERSION=${{ env .VERSION }}
111
109
export CLANG=clang-15
112
110
export STRIP=llvm-strip-15
113
111
make
114
- cp ./install/dae.service ./build/
115
- cp ./example.dae ./build/
116
- curl -L -o ./build/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
117
- curl -L -o ./build/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
112
+ install -Dm644 ./install/dae.service -t ./build/usr/lib/systemd/system/
113
+ install -Dm640 ./install/empty.dae ./build/etc/dae/config.dae
114
+ install -Dm644 ./example.dae -t ./build/etc/dae/
115
+ install -d ./build/usr/share/dae/
116
+ curl -L -o ./build/usr/share/dae/geoip.dat https://github.com/v2fly/geoip/releases/latest/download/geoip.dat
117
+ curl -L -o ./build/usr/share/dae/geosite.dat https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat
118
118
119
119
- name : Smoking test
120
120
if : matrix.goarch == 'amd64' && matrix.goamd64 == 'v1'
121
- run : ./build/dae-$ASSET_NAME --version
121
+ run : ./build/usr/bin/dae --version
122
+
123
+ - name : Create binary archive
124
+ run : tar -cJvf ./bundled/dae-$ASSET_NAME.tar.xz -C build .
122
125
123
- - name : Create binary ZIP archive and Signature
126
+ - name : Build Linux packages
127
+ if : ${{ env.GOARM == '7' || env.GOARM == '' }}
128
+ run : |
129
+ sudo apt install -y libarchive-tools
130
+ sudo gem install fpm
131
+
132
+ case $GOARCH in
133
+ 'amd64' | 'i386' | 'arm64' | 'arm' | 'riscv64' | 'loong64' | 'ppc64' | 'ppc64le') archlinux_pacman='pacman' ;;
134
+ *) echo "Skip unsupported architecture for Arch Linux" ;;
135
+ esac
136
+
137
+ for pkg_mgr in deb rpm $archlinux_pacman; do
138
+ case $GOARCH in
139
+ 'amd64')
140
+ if [ $pkg_mgr == 'deb' ]; then
141
+ pkg_arch='amd64'
142
+ else
143
+ pkg_arch='x86_64'
144
+ fi ;;
145
+ '386')
146
+ case $pkg_mgr in
147
+ 'deb') pkg_arch='i386' ;;
148
+ 'rpm') pkg_arch='x86' ;;
149
+ 'pacman') pkg_arch'i486' ;;
150
+ esac ;;
151
+ 'arm64')
152
+ if [ $pkg_mgr == 'deb' ]; then
153
+ pkg_arch='arm64'
154
+ else
155
+ pkg_arch='aarch64'
156
+ fi ;;
157
+ 'arm')
158
+ case $pkg_mgr in
159
+ 'deb') pkg_arch='armhf' ;;
160
+ 'rpm') pkg_arch='armhfp' ;;
161
+ 'pacman') pkg_arch='armv7h' ;;
162
+ esac ;;
163
+ 'loong64')
164
+ if [ $pkg_mgr != 'rpm' ]; then
165
+ pkg_arch='loong64'
166
+ else
167
+ pkg_arch='loongarch64'
168
+ fi ;;
169
+ 'mips64le') pkg_arch='mips64el' ;;
170
+ 'mipsle') pkg_arch='mipsel' ;;
171
+ 'ppc64le')
172
+ if [ $pkg_mgr == 'deb' ]; then
173
+ pkg_arch='ppc64el'
174
+ else
175
+ pkg_arch='ppc64le'
176
+ fi ;;
177
+ *) pkg_arch=$GOARCH ;;
178
+ esac
179
+
180
+ fpm -s dir -t $pkg_mgr -a $pkg_arch -v ${VERSION/v/} -n dae \
181
+ --url "https://github.com/daeuniverse/dae" \
182
+ --description "eBPF-based Linux high-performance transparent proxy solution" \
183
+ --maintainer "daeuniverse <[email protected] >" \
184
+ --license 'AGPL-3.0' \
185
+ --package ./bundled/dae-$ASSET_NAME.$pkg_mgr \
186
+ --after-install ./install/package_after_install.sh \
187
+ --after-remove ./install/package_after_remove.sh \
188
+ --deb-compression xz \
189
+ --deb-compression-level 9 \
190
+ --rpm-compression xz \
191
+ --verbose \
192
+ -C build .
193
+ done
194
+
195
+ if [ $archlinux_pacman == 'pacman' ]; then
196
+ mv ./bundled/dae-$ASSET_NAME.pacman ./bundled/dae-$ASSET_NAME.pkg.tar.zst
197
+ fi
198
+
199
+ - name : Create signature
124
200
run : |
125
- pushd build || exit 1
126
- zip -9vr ../dae-$ASSET_NAME.zip .
127
- popd || exit 1
128
- FILE=./dae-$ASSET_NAME.zip
129
- echo "$(md5sum $FILE)"" md5" >> $FILE.dgst
130
- echo "$(shasum -a 1 $FILE)"" sha1" >> $FILE.dgst
131
- echo "$(shasum -a 256 $FILE)"" sha256" >> $FILE.dgst
132
- echo "$(shasum -a 512 $FILE)"" sha512" >> $FILE.dgst
201
+ cd bundled
202
+ for FILE in *; do
203
+ echo "$(md5sum $FILE)"" md5" >> $FILE.dgst
204
+ echo "$(shasum -a 1 $FILE)"" sha1" >> $FILE.dgst
205
+ echo "$(shasum -a 256 $FILE)"" sha256" >> $FILE.dgst
206
+ echo "$(shasum -a 512 $FILE)"" sha512" >> $FILE.dgst
207
+ done
133
208
134
209
- name : Upload files to Artifacts
135
210
uses : nanoufo/action-upload-artifacts-and-release-assets@v2
136
211
with :
137
212
if-no-files-found : ignore
138
- path : |
139
- dae-${{ steps.get_filename.outputs.ASSET_NAME }}.zip
140
- dae-${{ steps.get_filename.outputs.ASSET_NAME }}.zip.dgst
141
- dae-full-src.zip
142
- dae-full-src.zip.dgst
213
+ path : ./bundled/*
143
214
144
215
upload-release :
145
216
needs : [build]
@@ -152,16 +223,13 @@ jobs:
152
223
153
224
- name : Prepare files for upload
154
225
run : |
155
- cp release/*/*.zip ./
156
- cp release/*/*.zip.dgst ./
157
226
echo "Show files are going to upload..."
158
- ls -lh | grep ".zip"
227
+ cd release
228
+ ls -lh */*
159
229
160
230
- name : Upload full source and artifacts to GitHub release
161
231
uses : softprops/action-gh-release@v2
162
232
with :
163
233
tag_name : ${{ inputs.tag }}
164
- files : |
165
- *zip
166
- *dgst
234
+ files : release/*/*
167
235
prerelease : true
0 commit comments