Skip to content

Commit e3a12f7

Browse files
committed
feat: build for wine
1 parent 3f20e31 commit e3a12f7

File tree

4 files changed

+386
-3
lines changed

4 files changed

+386
-3
lines changed

.github/workflows/release-wine.yml

Lines changed: 383 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,383 @@
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Build Packages
5+
6+
on:
7+
release:
8+
types: [published]
9+
push:
10+
tags:
11+
- v*
12+
branches: [ master, dev, 45-snap-version]
13+
pull_request:
14+
branches: [ master ]
15+
# # Allows you to run this workflow manually from the Actions tab
16+
# workflow_dispatch:
17+
18+
jobs:
19+
build-src:
20+
name: Build Base Packages
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
matrix:
25+
node-version: [16.x]
26+
ARCH: ['x86_64']
27+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
with:
32+
submodules: 'recursive'
33+
- name: Use Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v2
35+
36+
- name: Prepare
37+
run: |
38+
cd compiler && npm install
39+
echo "$UID, $GID"
40+
41+
- name: Generate TAG
42+
id: Tag
43+
run: |
44+
tag='continuous'
45+
name='Continuous Build'
46+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
47+
tag='${{ github.ref_name }}'
48+
name='${{ github.ref_name }}'
49+
fi
50+
echo "tag result: $tag - $name"
51+
echo "::set-output name=tag::$tag"
52+
echo "::set-output name=name::$name"
53+
54+
- name: Build
55+
run: |
56+
export ACTION_MODE=true
57+
export DOCKER_UID=$UID
58+
export DOCKER_GID=$GID
59+
ls -l
60+
export WINE=true
61+
docker-compose up
62+
63+
- name: Compress Resources
64+
run: |
65+
ls -l
66+
export WINE=true
67+
mkdir -p tmp/src
68+
rm -rf nwjs/node nwjs/node.exe
69+
cp node/bin/node nwjs/node
70+
cd nwjs && ln -s node node.exe
71+
cd ..
72+
tar -zcf tmp/src/src-wine.tar.gz bin nwjs package.nw tools
73+
74+
- name: Compress nodegit compiler
75+
run: |
76+
ls -l
77+
export WINE=true
78+
mkdir -p tmp/build
79+
cp -r package.nw/node_modules/nodegit .
80+
sudo rm -rf compiler/test
81+
tar -zcf compiler.tar.gz compiler
82+
tar -zcf nodegit.tar.gz nodegit
83+
mv nodegit.tar.gz tmp/build
84+
mv compiler.tar.gz tmp/build
85+
cd tmp/build
86+
ls -l
87+
88+
- name: View Directory
89+
run: |
90+
ls -l
91+
92+
- name: Upload artifact
93+
uses: actions/upload-artifact@v2.3.1
94+
with:
95+
# Artifact name
96+
name: wechat-devtools-${{ matrix.ARCH }}.src
97+
path: tmp/src
98+
99+
- name: Upload artifact
100+
uses: actions/upload-artifact@v2.3.1
101+
with:
102+
# Artifact name
103+
name: wechat-devtools-${{ matrix.ARCH }}.build
104+
path: tmp/build
105+
106+
build-tar:
107+
name: Build tar.gz AppImage
108+
needs:
109+
- build-src
110+
runs-on: ubuntu-latest
111+
112+
strategy:
113+
matrix:
114+
node-version: [16.x]
115+
ARCH: ['x86_64']
116+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
117+
118+
steps:
119+
- uses: actions/checkout@v2
120+
- name: Download artifacts
121+
uses: actions/download-artifact@v2
122+
123+
- name: Prepare
124+
run: |
125+
cd compiler && npm install
126+
echo "$UID, $GID"
127+
128+
- name: Generate TAG
129+
id: Tag
130+
run: |
131+
tag='continuous'
132+
name='Continuous Build'
133+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
134+
tag='${{ github.ref_name }}'
135+
name='${{ github.ref_name }}'
136+
fi
137+
echo "tag result: $tag - $name"
138+
echo "::set-output name=tag::$tag"
139+
echo "::set-output name=name::$name"
140+
141+
- name: Build
142+
run: |
143+
export WINE=true
144+
export ACTION_MODE=true
145+
# tar.gz AppImage
146+
ls -l
147+
mkdir -p tmp/build
148+
tools/build-prepare.sh
149+
tools/build-release.sh ${{ matrix.ARCH }} ${{ steps.tag.outputs.tag }}
150+
151+
- name: View Directory
152+
run: |
153+
ls -l
154+
155+
- name: Upload artifact
156+
uses: actions/upload-artifact@v2.3.1
157+
with:
158+
# Artifact name
159+
name: wechat-devtools-${{ matrix.ARCH }}.build
160+
path: tmp/build
161+
162+
build-deb:
163+
name: Build DEB Package
164+
needs:
165+
- build-src
166+
runs-on: ubuntu-18.04
167+
168+
strategy:
169+
matrix:
170+
ARCH: ['x86_64']
171+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
172+
173+
steps:
174+
- uses: actions/checkout@v2
175+
- name: Download artifacts
176+
uses: actions/download-artifact@v2
177+
178+
- name: Generate TAG
179+
id: Tag
180+
run: |
181+
tag='continuous'
182+
name='Continuous Build'
183+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
184+
tag='${{ github.ref_name }}'
185+
name='${{ github.ref_name }}'
186+
fi
187+
echo "tag result: $tag - $name"
188+
echo "::set-output name=tag::$tag"
189+
echo "::set-output name=name::$name"
190+
# https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
191+
- name: Configure GPG Key
192+
run: |
193+
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
194+
env:
195+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
196+
197+
- name: Prepare
198+
run: |
199+
sudo apt-get install -y build-essential fakeroot devscripts debhelper # debmake lintian pbuilder
200+
201+
- name: Build Deb Package
202+
run: |
203+
export BUILD_VERSION=${{ steps.tag.outputs.tag }}
204+
ls -l
205+
mkdir -p tmp/build
206+
export WINE=true
207+
tools/build-prepare.sh
208+
tools/build-deepin.sh ${{ steps.tag.outputs.tag }}
209+
210+
- name: Upload artifact
211+
uses: actions/upload-artifact@v2.3.1
212+
with:
213+
# Artifact name
214+
name: wechat-devtools-${{ matrix.ARCH }}.build
215+
path: tmp/build
216+
217+
build-arch:
218+
name: Build ArchLinux Package
219+
runs-on: ubuntu-latest
220+
timeout-minutes: 30
221+
strategy:
222+
matrix:
223+
node-version: [16.x]
224+
ARCH: ['x86_64']
225+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
226+
227+
steps:
228+
- uses: actions/checkout@v2
229+
with:
230+
submodules: 'recursive'
231+
- name: Use Node.js ${{ matrix.node-version }}
232+
uses: actions/setup-node@v2
233+
with:
234+
node-version: ${{ matrix.node-version }}
235+
cache: 'npm'
236+
237+
- name: Prepare
238+
run: |
239+
cd compiler && npm install
240+
npm install node-gyp nw-gyp npm -g
241+
node-gyp install
242+
cat /etc/passwd
243+
244+
- name: Generate TAG
245+
id: Tag
246+
run: |
247+
tag='continuous'
248+
name='Continuous Build'
249+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
250+
tag='${{ github.ref_name }}'
251+
name='${{ github.ref_name }}'
252+
fi
253+
echo "tag result: $tag - $name"
254+
echo "::set-output name=tag::$tag"
255+
echo "::set-output name=name::$name"
256+
257+
- name: Build ArchLinux Package
258+
uses: countstarlight/arch-makepkg-action@master
259+
env:
260+
BUILD_VERSION: ${{ steps.tag.outputs.tag }}
261+
with:
262+
repos: >
263+
archlinuxcn=https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
264+
before: "tools/build-aur.sh && sudo pacman -S --noconfirm archlinuxcn-keyring"
265+
packages: >
266+
gconf
267+
p7zip
268+
libxkbfile
269+
python2
270+
openssl
271+
gcc
272+
make
273+
libssh2
274+
krb5
275+
wget
276+
scripts: "cd tmp/AUR && makepkg && ls -l && cd ../../"
277+
278+
- name: Fix Permissions
279+
run: |
280+
sudo chmod -R 0777 tmp
281+
mkdir -p tmp/build
282+
mv tmp/AUR/*.pkg.* tmp/build
283+
cd tmp/build
284+
for file in `ls *.pkg.*`;do mv $file `echo $file|sed 's/:/-/g'`;done;
285+
ls -l
286+
287+
- name: Upload artifact
288+
uses: actions/upload-artifact@v2.3.1
289+
with:
290+
# Artifact name
291+
name: wechat-devtools-${{ matrix.ARCH }}.build
292+
path: tmp/build
293+
294+
build-snap:
295+
name: Build Snap Package
296+
runs-on: ubuntu-18.04
297+
timeout-minutes: 30
298+
strategy:
299+
matrix:
300+
node-version: [16.x]
301+
ARCH: ['x86_64']
302+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
303+
304+
steps:
305+
- uses: actions/checkout@v2
306+
with:
307+
submodules: 'recursive'
308+
- name: Install Snapcraft
309+
uses: samuelmeuli/action-snapcraft@v1
310+
with:
311+
use_lxd: true
312+
313+
- name: Prepare
314+
run: |
315+
cd compiler && npm install
316+
git --version
317+
git --help
318+
319+
# You can now run Snapcraft shell commands
320+
- name: Build snap
321+
run: sg lxd -c 'snapcraft --use-lxd'
322+
323+
- name: move file
324+
run: |
325+
mkdir -p tmp/build
326+
mv *.snap tmp/build
327+
- name: Upload artifact
328+
uses: actions/upload-artifact@v2.3.1
329+
with:
330+
# Artifact name
331+
name: wechat-devtools-${{ matrix.ARCH }}.build
332+
path: tmp/build
333+
334+
upload:
335+
name: Create release and upload artifacts
336+
needs:
337+
- build-tar
338+
- build-deb
339+
- build-snap
340+
- build-arch
341+
runs-on: ubuntu-latest
342+
steps:
343+
- name: Download artifacts
344+
uses: actions/download-artifact@v2
345+
- name: Inspect directory after downloading artifacts
346+
run: ls -alFR
347+
348+
- name: Generate TAG
349+
id: Tag
350+
run: |
351+
tag='continuous'
352+
name='Continuous Build'
353+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
354+
tag='${{ github.ref_name }}'
355+
name='${{ github.ref_name }}'
356+
fi
357+
echo "tag result: $tag - $name"
358+
echo "::set-output name=tag::$tag"
359+
echo "::set-output name=name::$name"
360+
361+
- name: Create release and upload artifacts
362+
if: startsWith(github.ref, 'refs/heads/')
363+
env:
364+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
365+
run: |
366+
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
367+
chmod +x pyuploadtool-x86_64.AppImage
368+
./pyuploadtool-x86_64.AppImage **build/WeChat*.AppImage **build/*.tar.gz **build/*.deb **build/*.pkg.* **build/*.snap
369+
370+
- name: Release
371+
uses: softprops/action-gh-release@v1
372+
if: startsWith(github.ref, 'refs/tags/')
373+
with:
374+
# note you'll typically need to create a personal access token
375+
# with permissions to create releases in the other repo
376+
name: ${{ steps.tag.outputs.name }}
377+
tag_name: ${{ steps.tag.outputs.tag }}
378+
files: |
379+
**build/WeChat*.AppImage
380+
**build/*.tar.gz
381+
**build/*.deb
382+
**build/*.pkg.*
383+
**build/*.snap

tools/build-appimage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ elif [[ $ARCH == '' ]];then
3030
fi
3131

3232
if [[ "$WINE" != 'true' ]];then
33-
TYPE='no_wine'
33+
TYPE='linux'
3434
else
3535
TYPE='wine'
3636
fi

0 commit comments

Comments
 (0)