Skip to content

Commit 7f2112e

Browse files
committed
Squashed commit of the following:
commit 1d759c8 Author: msojocs <jiyecafe@gmail.com> Date: Tue Mar 1 16:13:26 2022 +0800 feat: AUR Build
1 parent 5908cdf commit 7f2112e

File tree

6 files changed

+465
-10
lines changed

6 files changed

+465
-10
lines changed

.github/workflows/release.yml

Lines changed: 187 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# 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
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
33

4-
name: Node.js CI
4+
name: Build Packages
55

66
on:
77
release:
88
types: [published]
99
push:
1010
tags:
1111
- v*
12-
branches: [ master, actions-dev]
12+
branches: [ master, aur]
1313
pull_request:
1414
branches: [ master ]
1515
# # Allows you to run this workflow manually from the Actions tab
1616
# workflow_dispatch:
1717

1818
jobs:
1919
build:
20-
name: Build
20+
name: Build tar.gz AppImage
2121
runs-on: ubuntu-latest
2222

2323
strategy:
@@ -43,7 +43,8 @@ jobs:
4343
npm install node-gyp nw-gyp npm -g
4444
node-gyp install
4545
46-
- id: Tag
46+
- name: Generate TAG
47+
id: Tag
4748
run: |
4849
tag='continuous'
4950
name='Continuous Build'
@@ -54,10 +55,13 @@ jobs:
5455
echo "tag result: $tag - $name"
5556
echo "::set-output name=tag::$tag"
5657
echo "::set-output name=name::$name"
57-
58+
5859
- name: Build
5960
run: |
6061
# docker-compose up
62+
export ACTION=true
63+
# tar.gz AppImage
64+
ls -l
6165
tools/setup-wechat-devtools-bash
6266
sudo chmod -R 755 package.nw
6367
bash tools/build-release.sh ${{ steps.tag.outputs.tag }} ${{ matrix.ARCH }}
@@ -78,15 +82,187 @@ jobs:
7882
run: |
7983
ls -l
8084
85+
- name: Upload artifact
86+
uses: actions/upload-artifact@v2.3.1
87+
with:
88+
# Artifact name
89+
name: wechat-devtools-${{ matrix.ARCH }}.build
90+
path: tmp/build
91+
92+
build-deb:
93+
name: Build Deb Package
94+
runs-on: ubuntu-latest
95+
96+
strategy:
97+
matrix:
98+
node-version: [16.x]
99+
ARCH: ['x86_64']
100+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
101+
102+
steps:
103+
- uses: actions/checkout@v2
104+
- name: Use Node.js ${{ matrix.node-version }}
105+
uses: actions/setup-node@v2
106+
with:
107+
node-version: ${{ matrix.node-version }}
108+
cache: 'npm'
109+
110+
- name: Prepare
111+
run: |
112+
pwd
113+
ls -l
114+
export ACTION_MODE=true
115+
sudo apt-get install -y libx11-dev libxkbfile-dev p7zip-full python2 python3 libkrb5-dev gcc openssl libssh2-1-dev g++ make
116+
npm install node-gyp nw-gyp npm -g
117+
node-gyp install
118+
# https://docs.makedeb.org/home/installing/apt-repository/
119+
wget -qO - 'https://proget.hunterwittenborn.com/debian-feeds/makedeb.pub' | \
120+
gpg --dearmor | \
121+
sudo tee /usr/share/keyrings/makedeb-archive-keyring.gpg &> /dev/null
122+
echo 'deb [signed-by=/usr/share/keyrings/makedeb-archive-keyring.gpg arch=all] https://proget.hunterwittenborn.com/ makedeb main' | \
123+
sudo tee /etc/apt/sources.list.d/makedeb.list
124+
sudo apt update
125+
sudo apt-get install -y makedeb gconf2
126+
127+
- name: Generate TAG
128+
id: Tag
129+
run: |
130+
tag='continuous'
131+
name='Continuous Build'
132+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
133+
tag='${{ github.ref_name }}'
134+
name='${{ github.ref_name }}'
135+
fi
136+
echo "tag result: $tag - $name"
137+
echo "::set-output name=tag::$tag"
138+
echo "::set-output name=name::$name"
139+
140+
- name: Build Deb Package
141+
run: |
142+
tools/build-aur.sh deb
143+
# deb
144+
cd tmp/AUR
145+
makedeb
146+
cd ../
147+
# ./tmp
148+
ls -l AUR
149+
mkdir -p build
150+
mv AUR/*.deb build
151+
rm -rf AUR/pkg AUR/src
152+
ls -l build
153+
154+
- name: Upload artifact
155+
uses: actions/upload-artifact@v2.3.1
156+
with:
157+
# Artifact name
158+
name: wechat-devtools-${{ matrix.ARCH }}.build
159+
path: tmp/build
160+
161+
build-arch:
162+
name: Build ArchLinux Package
163+
runs-on: ubuntu-latest
164+
timeout-minutes: 30
165+
strategy:
166+
matrix:
167+
node-version: [16.x]
168+
ARCH: ['x86_64']
169+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
170+
171+
steps:
172+
- uses: actions/checkout@v2
173+
- name: Use Node.js ${{ matrix.node-version }}
174+
uses: actions/setup-node@v2
175+
with:
176+
node-version: ${{ matrix.node-version }}
177+
cache: 'npm'
178+
179+
- name: Prepare
180+
run: |
181+
npm install node-gyp nw-gyp npm -g
182+
node-gyp install
183+
cat /etc/passwd
184+
185+
- name: Generate TAG
186+
id: Tag
187+
run: |
188+
tag='continuous'
189+
name='Continuous Build'
190+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
191+
tag='${{ github.ref_name }}'
192+
name='${{ github.ref_name }}'
193+
fi
194+
echo "tag result: $tag - $name"
195+
echo "::set-output name=tag::$tag"
196+
echo "::set-output name=name::$name"
197+
198+
- name: Build ArchLinux Package
199+
uses: countstarlight/arch-makepkg-action@master
200+
with:
201+
repos: >
202+
archlinuxcn=https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/$arch
203+
before: "tools/build-aur.sh && sudo pacman -S --noconfirm archlinuxcn-keyring"
204+
packages: >
205+
gconf
206+
p7zip
207+
libxkbfile
208+
python2
209+
openssl
210+
gcc
211+
make
212+
libssh2
213+
krb5
214+
scripts: "cd tmp/AUR && makepkg && ls -l && cd ../../"
215+
216+
- name: Fix Permissions
217+
run: |
218+
sudo chmod -R 0777 tmp
219+
mkdir -p tmp/build
220+
mv tmp/AUR/*.pkg.* tmp/build
221+
cd tmp/build
222+
for file in `ls *.pkg.*`;do mv $file `echo $file|sed 's/:/-/g'`;done;
223+
ls -l
224+
225+
- name: Upload artifact
226+
uses: actions/upload-artifact@v2.3.1
227+
with:
228+
# Artifact name
229+
name: wechat-devtools-${{ matrix.ARCH }}.build
230+
path: tmp/build
231+
232+
upload:
233+
name: Create release and upload artifacts
234+
needs:
235+
- build
236+
- build-deb
237+
- build-arch
238+
runs-on: ubuntu-latest
239+
steps:
240+
- name: Download artifacts
241+
uses: actions/download-artifact@v2
242+
- name: Inspect directory after downloading artifacts
243+
run: ls -alFR
244+
245+
- name: Generate TAG
246+
id: Tag
247+
run: |
248+
tag='continuous'
249+
name='Continuous Build'
250+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
251+
tag='${{ github.ref_name }}'
252+
name='${{ github.ref_name }}'
253+
fi
254+
echo "tag result: $tag - $name"
255+
echo "::set-output name=tag::$tag"
256+
echo "::set-output name=name::$name"
257+
81258
- name: Create release and upload artifacts
82259
if: startsWith(github.ref, 'refs/heads/')
83260
env:
84261
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85262
run: |
86-
cd tmp/build
87263
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
88264
chmod +x pyuploadtool-x86_64.AppImage
89-
./pyuploadtool-x86_64.AppImage WeChat*.AppImage *.tar.gz
265+
./pyuploadtool-x86_64.AppImage **/WeChat*.AppImage **/*.tar.gz **/*.deb **/*.pkg.*
90266
91267
- name: Release
92268
uses: softprops/action-gh-release@v1
@@ -97,5 +273,7 @@ jobs:
97273
name: ${{ steps.tag.outputs.name }}
98274
tag_name: ${{ steps.tag.outputs.tag }}
99275
files: |
100-
tmp/build/*.tar.gz
101-
tmp/build/*.AppImage
276+
**/WeChat*.AppImage
277+
**/*.tar.gz
278+
**/*.deb
279+
**/*.pkg.*

res/aur/PKGBUILD

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Maintainer: msojocs <jiyecafe@gmail.com>
2+
# Contributor: ccat3z <c0ldcat3z@gmail.com>
3+
# Contributor: bruceutut <zttt183525594@gmail.com>
4+
5+
# 方法参考
6+
# https://github.com/jiyeme/wechat-devtools
7+
# https://github.com/dragonation/wechat-devtools
8+
# https://github.com/cytle/wechat_web_devtools
9+
10+
_wechat_devtools_ver="1.05.2201240"
11+
_wechat_devtools_url="https://dldir1.qq.com/WechatWebDev/release/p-ae42ee2cde4d42ee80ac60b35f183a99/wechat_devtools_1.05.2201240_x64.exe"
12+
_wechat_devtools_md5="85552bae33e98eb186c5068419efce03"
13+
14+
_wechat_devtools_exe="wechat_devtools_${_wechat_devtools_ver}_x64.exe"
15+
_nwjs_ver="0.53.1"
16+
_install_dir="/opt/wechat-devtools"
17+
_node_version="16.1.0"
18+
19+
pkgname=wechat-devtools
20+
pkgver="${_wechat_devtools_ver}" # 主版本号
21+
pkgrel=15 # 次版本号release
22+
epoch=2 # 大版本迭代强制更新(维护者变更,尽量不用)
23+
pkgdesc="WeChat Devtools For Linux. "
24+
arch=("x86_64")
25+
url="https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html"
26+
license=('unknown')
27+
depends=('gconf' 'libxkbfile')
28+
makedepends=('p7zip' 'python2' 'openssl' 'gcc' 'make' 'libssh2' 'krb5')
29+
# compiler 用于可视化,以及编译
30+
source=("nwjs-v${_nwjs_ver}.tar.gz::https://npm.taobao.org/mirrors/nwjs/v${_nwjs_ver}/nwjs-sdk-v${_nwjs_ver}-linux-x64.tar.gz"
31+
"${_wechat_devtools_exe}::${_wechat_devtools_url}"
32+
"node-v${_node_version}.tar.gz::https://npm.taobao.org/mirrors/node/v${_node_version}/node-v${_node_version}-linux-x64.tar.gz"
33+
"compiler.tar.gz::https://download.fastgit.org/msojocs/wechat-devtools-linux/releases/download/v0.19/compiler.tar.gz"
34+
"wechat-devtools.desktop"
35+
"logo.svg"
36+
"fix-cli.sh"
37+
"fix-menu.sh"
38+
"fix-core.sh"
39+
"rebuild-node-modules.sh"
40+
"fix-package-name.js"
41+
"wxvpkg_pack.js"
42+
"wxvpkg_unpack.js"
43+
"fix-other.sh")
44+
md5sums=(b6f49803c51d0abacca2d1e566c7fe19 # nwjs
45+
"${_wechat_devtools_md5}"
46+
2280bfbbf29981fd5adce334f40146ff # nodejs
47+
a9e061c97afbbc295b5664a2d8065492 # compiler
48+
1abd6b4ebbbb918f601a6c5dbad55a05 # desktop
49+
0f4353664123320280ea4d6bb295dce2 # svg
50+
"SKIP"
51+
"SKIP"
52+
"SKIP"
53+
"SKIP"
54+
"SKIP"
55+
"SKIP"
56+
"SKIP"
57+
"SKIP")
58+
options=('!strip')
59+
60+
prepare() {
61+
7z x -owechat_devtools ${_wechat_devtools_exe} code/package.nw
62+
mv wechat_devtools/code/package.nw package.nw
63+
rm -rf wechat_devtools
64+
ls | grep node-*linux* | xargs -I{} mv {} node
65+
ls | grep nwjs-*linux* | xargs -I{} mv {} nwjs
66+
67+
mkdir tools
68+
for file in *.js *.sh; do
69+
mv $file tools;
70+
done
71+
}
72+
73+
_log() {
74+
echo -e "\e[1;34m$@\e[0m"
75+
}
76+
77+
build() {
78+
# prepare node
79+
_log "prepare node v${_node_version}"
80+
export PATH="$srcdir/node/bin:$PATH"
81+
82+
# prepare nw-gyp
83+
_log "prepare nw-gyp"
84+
npm uninstall node-gyp -g
85+
npm install nw-gyp node-gyp -g
86+
87+
# node bin
88+
_log "copy node exectuable"
89+
cp "$(which node)" "${srcdir}/node.${_node_version}"
90+
91+
# run fix scripts
92+
export NW_PACKAGE_DIR="${srcdir}/package.nw"
93+
export NW_VERSION=$_nwjs_ver
94+
export srcdir=$srcdir
95+
export NO_WINE=true
96+
97+
for script in fix-package-name.js fix-cli.sh fix-other.sh fix-menu.sh fix-core.sh rebuild-node-modules.sh; do
98+
_log "run ${script}"
99+
"${srcdir}/tools/${script}"
100+
done
101+
102+
# cleanup
103+
_log "done"
104+
}
105+
106+
package() {
107+
mkdir -p "${pkgdir}${_install_dir}"
108+
cd "${pkgdir}${_install_dir}"
109+
110+
cp -r "${srcdir}/nwjs/"* ./
111+
cp -r "${srcdir}/package.nw" ./package.nw
112+
find ./package.nw -type d | xargs -I {} chmod -R a+rx {}
113+
114+
cp ${srcdir}/node.${_node_version} node
115+
ln -s node node.exe
116+
117+
install -Dm644 "${srcdir}/wechat-devtools.desktop" "${pkgdir}/usr/share/applications/wechat-devtools.desktop"
118+
install -Dm644 "${srcdir}/logo.svg" "${pkgdir}/usr/share/icons/hicolor/scalable/apps/wechat-devtools.svg"
119+
}

0 commit comments

Comments
 (0)