Skip to content

Commit 1f61b35

Browse files
committed
feat: appimage
1 parent e16c840 commit 1f61b35

File tree

8 files changed

+122
-37
lines changed

8 files changed

+122
-37
lines changed

.github/workflows/release.yml

Lines changed: 78 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,59 +9,101 @@ on:
99
push:
1010
tags:
1111
- v*
12-
branches: [ master, actions ]
12+
branches: [ master, appimage ]
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-
2120
name: Build
2221
runs-on: ubuntu-latest
2322

2423
strategy:
2524
matrix:
2625
node-version: [16.x]
26+
ARCH: ['x86_64']
2727
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2828

2929
steps:
30-
- uses: actions/checkout@v2
31-
- name: Use Node.js ${{ matrix.node-version }}
32-
uses: actions/setup-node@v2
33-
with:
34-
node-version: ${{ matrix.node-version }}
35-
cache: 'npm'
30+
- uses: actions/checkout@v2
31+
- name: Use Node.js ${{ matrix.node-version }}
32+
uses: actions/setup-node@v2
33+
with:
34+
node-version: ${{ matrix.node-version }}
35+
cache: 'npm'
3636

37-
- name: Prepare
38-
run: |
39-
pwd
40-
ls -l
41-
chmod 777 docker/entrypoint
42-
chmod 777 tools/*
43-
export ACTION_MODE=true
44-
npm uninstall node-gyp -g
45-
npm install node-gyp nw-gyp npm -g
37+
- name: Prepare
38+
run: |
39+
pwd
40+
ls -l
41+
export ACTION_MODE=true
42+
npm uninstall node-gyp -g
43+
npm install node-gyp nw-gyp npm -g
44+
45+
- id: tag
46+
run: |
47+
tag='continuous'
48+
name='Continuous Build'
49+
if [ 'true' == ${{ startsWith(github.ref, 'refs/tags/') }} ];then
50+
tag='${{ github.ref_name }}'
51+
name='${{ github.ref_name }}'
52+
fi
53+
echo "tag result: $tag - $name"
54+
echo "::set-output name=tag::$tag"
55+
echo "::set-output name=name::$name"
56+
57+
- name: Build
58+
run: docker-compose up
4659

47-
- name: Build
48-
run: docker-compose up
60+
- name: Build AppImage
61+
run: |
62+
sudo chmod -R 777 tmp package.nw node
63+
bash tools/appimage.sh
64+
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
65+
chmod a+x appimagetool-x86_64.AppImage
66+
./appimagetool-x86_64.AppImage ./tmp/AppDir
67+
env:
68+
name: 'release-${{ github.ref_name }}'
69+
ARCH: '${{ matrix.ARCH }}'
4970

50-
- name: Delete unused file
51-
run: |
52-
sudo rm -rf cache tmp
53-
mkdir ${{ env. name }}
54-
sudo find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \;
55-
sudo cp -r "${{ env.name }}/package.nw/node_modules/nodegit" nodegit
56-
sudo cp -r "${{ env.name }}/compiler" compiler
57-
ls -ls
58-
env:
59-
name: 'release-${{ github.ref_name }}'
71+
- name: Delete unused file
72+
run: |
73+
ls -l
74+
sudo rm -rf cache tmp appimagetool-x86_64.AppImage
75+
mkdir ${{ env. name }}
76+
sudo find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \;
77+
sudo cp -r "${{ env.name }}/package.nw/node_modules/nodegit" nodegit
78+
sudo cp -r "${{ env.name }}/compiler" compiler
79+
sudo mv ${{ env.name }}/WeChat*.AppImage .
80+
ls -l
81+
cd "${{ env.name }}"
82+
env:
83+
name: 'release-${{ github.ref_name }}'
84+
85+
- name: Compress
86+
run: |
87+
ls -l
88+
tar -zvcf ${{ env.name }}.tar.gz ${{ env.name }}
89+
tar -zvcf compiler.tar.gz compiler
90+
tar -zvcf nodegit.tar.gz nodegit
91+
sudo rm -rf ${{ env.name }} compiler nodegit
92+
ls -l
93+
env:
94+
name: 'release-${{ github.ref_name }}'
6095

61-
- name: Release
62-
uses: fnkr/github-action-ghr@v1
63-
if: startsWith(github.ref, 'refs/tags/')
64-
env:
65-
GHR_COMPRESS: xz
66-
GHR_PATH: .
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
- name: Release
97+
uses: softprops/action-gh-release@v1
98+
with:
99+
# note you'll typically need to create a personal access token
100+
# with permissions to create releases in the other repo
101+
name: ${{ steps.tag.outputs.name }}
102+
tag_name: ${{ steps.tag.outputs.tag }}
103+
files: |
104+
${{ env.name }}.tar.gz
105+
compiler.tar.gz
106+
nodegit.tar.gz
107+
*.AppImage
108+
env:
109+
name: 'release-${{ github.ref_name }}'

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ node_modules
99
test/mini-ci
1010
crash-server
1111
build
12-
*.snap
12+
*.snap
13+
*.AppImage
14+
appimage-builder-cache

docker/entrypoint

100644100755
File mode changed.

docs/Features.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [x] 导入项目
66
- [x] 创建项目
77
- [x] 打开项目
8+
- [x] ADB (请自行安装ADB)
89

910
## 小程序基本功能
1011

res/appimage.desktop

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Desktop Entry]
2+
Name=WeChat Dev Tools
3+
Name[zh_CN]=微信开发者工具
4+
Comment=The development tools for wechat projects
5+
Comment[zh_CN]=提供微信开发相关项目的开发IDE支持
6+
Categories=Development;WebDevelopment;IDE;
7+
Exec=bin/wechat-devtools
8+
Icon=wechat-devtools
9+
Type=Application
10+
Terminal=false
11+
StartupWMClass=wechat_devtools
12+
Actions=

tools/appimage.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
export ARCH=x86_64
3+
4+
root_dir=$(cd `dirname $0`/.. && pwd -P)
5+
tmp_dir="$root_dir/tmp"
6+
app_dir="$root_dir/tmp/AppDir"
7+
8+
# Remove any previous build
9+
rm -rf $app_dir
10+
# Make usr and icons dirs
11+
mkdir -p $app_dir/bin
12+
mkdir -p $app_dir/usr/{src,bin}
13+
mkdir -p $app_dir/usr/share/{metainfo,icons}
14+
15+
cp "$root_dir/bin/wechat-devtools" "$app_dir/bin/wechat-devtools"
16+
cp "$root_dir/res/appimage.desktop" "$app_dir/wechat-devtools.desktop"
17+
cp "$root_dir/res/icons/wechat-devtools.png" "$app_dir/wechat-devtools.png"
18+
19+
echo "#!/bin/bash" > "$app_dir/AppRun"
20+
echo "exec bin/wechat-devtools" >> "$app_dir/AppRun"
21+
chmod +x "$app_dir/AppRun"
22+
23+
cp -r "$root_dir/package.nw" "$app_dir/package.nw"
24+
cp -r "$root_dir/nwjs" "$app_dir/nwjs"
25+
rm -rf "$app_dir/nwjs/node" "$app_dir/nwjs/node.exe"
26+
cp -r "$root_dir/node/bin/node" "$app_dir/nwjs/node"
27+
cd "$app_dir/nwjs/" && ln -s "node" "node.exe"
28+
cd "$app_dir"

tools/fix-wcc-wcsc

100644100755
File mode changed.

tools/setup-wechat-devtools-bash

100644100755
File mode changed.

0 commit comments

Comments
 (0)