Squashed commit of the following:

commit 48f6b5450d7d0983f1f697c176cf1e129bb51629
Author: msojocs <jiyecafe@gmail.com>
Date:   Fri Mar 4 18:12:47 2022 +0800

    refactor: build
This commit is contained in:
msojocs 2022-03-04 18:17:43 +08:00
parent 3f7f7a68d5
commit d0a79076b4
15 changed files with 251 additions and 239 deletions

View File

@ -9,7 +9,7 @@ on:
push: push:
tags: tags:
- v* - v*
branches: [ master, aur] branches: [ master, build]
pull_request: pull_request:
branches: [ master ] branches: [ master ]
# # Allows you to run this workflow manually from the Actions tab # # Allows you to run this workflow manually from the Actions tab
@ -22,7 +22,6 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [16.x]
ARCH: ['x86_64'] ARCH: ['x86_64']
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
@ -30,18 +29,10 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Prepare - name: Test
run: | run: |
pwd echo "$UID, $GID"
ls -l
export ACTION_MODE=true
sudo apt-get install -y libx11-dev libxkbfile-dev p7zip-full python2 python3 libkrb5-dev gcc openssl libssh2-1-dev g++ make
npm install node-gyp nw-gyp npm -g
node-gyp install
- name: Generate TAG - name: Generate TAG
id: Tag id: Tag
@ -58,24 +49,25 @@ jobs:
- name: Build - name: Build
run: | run: |
# docker-compose up export ACTION_MODE=true
export ACTION=true export DOCKER_UID=$UID
export DOCKER_GID=$GID
# tar.gz AppImage # tar.gz AppImage
ls -l ls -l
tools/setup-wechat-devtools-bash docker-compose up
sudo chmod -R 755 package.nw mkdir -p tmp/build
bash tools/build-release.sh ${{ steps.tag.outputs.tag }} ${{ matrix.ARCH }} tools/build-release.sh ${{ steps.tag.outputs.tag }} ${{ matrix.ARCH }}
- name: Compress nodegit compiler - name: Compress nodegit compiler
run: | run: |
ls -l ls -l
sudo cp -r package.nw/node_modules/nodegit tmp/build/nodegit cp -r package.nw/node_modules/nodegit tmp/build/nodegit
sudo cp -r compiler tmp/build/compiler cp -r compiler tmp/build/compiler
cd tmp/build cd tmp/build
ls -l ls -l
tar -zcf compiler.tar.gz compiler tar -zcf compiler.tar.gz compiler
tar -zcf nodegit.tar.gz nodegit tar -zcf nodegit.tar.gz nodegit
sudo rm -rf compiler nodegit rm -rf compiler nodegit
ls -l ls -l
- name: View Directory - name: View Directory
@ -119,14 +111,12 @@ jobs:
- name: Build Deb Package - name: Build Deb Package
run: | run: |
export BUILD_VERSION=${{ steps.tag.outputs.tag }} export BUILD_VERSION=${{ steps.tag.outputs.tag }}
tools/build-deb.sh export DOCKER_UID=$UID
# deb export DOCKER_GID=$GID
sudo chmod -R 777 tmp docker-compose up
cd tmp ls -l
ls -l deb mkdir -p tmp/build
mkdir -p build tools/build-deb.sh ${{ steps.tag.outputs.tag }}
mv deb/*.deb build
ls -l build
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v2.3.1 uses: actions/upload-artifact@v2.3.1

View File

@ -1,17 +1,19 @@
version: "3" version: "3"
services: services:
wechat_devtools: wechat_devtools:
# image: node:16.13.1 image: jiyecafe/wechat-devtools-build:latest
build: # build:
context: ./docker # context: ./docker
dockerfile: Dockerfile # dockerfile: Dockerfile
volumes: volumes:
- .:/workspace - .:/workspace
- ./cache/.npm:/root/.npm - ./cache/.npm:/root/.npm
environment: environment:
- ACTION=${ACTION_MODE:-false} - ACTION_MODE=${ACTION_MODE:-false}
# - https_proxy=${https_proxy:-} # - https_proxy=${https_proxy:-}
- NO_WINE=${NO_WINE:-true} - NO_WINE=${NO_WINE:-true}
- LOCAL_USER_ID=${UID:-1000} - LOCAL_USER_ID=${DOCKER_UID:-1000}
- LOCAL_GROUP_ID=${DOCKER_GID:-1000}
- BUILD_VERSION=${BUILD_VERSION:-v0}
entrypoint: /workspace/docker/docker-entrypoint entrypoint: /workspace/docker/docker-entrypoint
userns_mode: "host" userns_mode: "host"

View File

@ -1,20 +1,32 @@
FROM node:16.13.1 FROM debian:9.13-slim
RUN echo "\
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free\
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free\
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free\
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free\
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
"> /etc/apt/sources.list && apt-get clean && \
apt-get update && set -eux; \
apt-get update; \
apt-get install -y gosu libx11-dev libxkbfile-dev p7zip-full; \
rm -rf /var/lib/apt/lists/*; \
# verify that the binary works
gosu nobody true;
WORKDIR /workspace WORKDIR /workspace
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
mkdir -p /build_temp/python36 /build_temp/nodejs && \
apt update && \
apt install -y binutils software-properties-common gcc g++ \
gconf2 libxkbfile-dev p7zip-full make libssh2-1-dev libkrb5-dev wget \
openssl pkg-config build-essential && \
cd /build_temp/python36 && \
apt-get install -y aptitude &&\
aptitude -y install gcc make zlib1g-dev libffi-dev libssl-dev &&\
mkdir -p test && cd test &&\
wget http://npm.taobao.org/mirrors/python/3.6.5/Python-3.6.5.tgz &&\
tar -xvf Python-3.6.5.tgz &&\
chmod -R +x Python-3.6.5 &&\
cd Python-3.6.5/ &&\
./configure &&\
aptitude -y install libffi-dev libssl-dev &&\
make && make install &&\
cd /build_temp/nodejs &&\
wget https://deb.nodesource.com/setup_16.x &&\
chmod +x setup_16.x &&\
./setup_16.x &&\
apt-get install -y nodejs &&\
rm -rf /build_temp && \
apt install -y gosu && \
gosu nobody true && \
useradd -s /bin/bash -m user

View File

@ -1,13 +1,21 @@
#!/bin/bash #!/bin/bash
if [ "$(id -u)" -eq '0' ] strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC
then strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_2.2
USER_ID=${LOCAL_USER_ID:-9001}
usermod -u ${USER_ID} -g ${USER_ID} node > /dev/null 2>&1 notice() {
chown -R ${USER_ID}:${USER_ID} /workspace > /dev/null 2>&1 echo -e "\033[36m $1 \033[0m "
}
if [ "$(id -u)" -eq '0' ];then
USER_ID=${LOCAL_USER_ID:-1000}
GROUP_ID=${LOCAL_GROUP_ID:-1000}
notice "$USER_ID, $GROUP_ID"
usermod -u ${USER_ID} -g ${GROUP_ID} user > /dev/null 2>&1
chown -R ${USER_ID}:${GROUP_ID} /workspace > /dev/null 2>&1
ACTION_MODE=$( export ACTION_MODE )
if [ $ACTION_MODE!='true' ]; then if [ $ACTION_MODE!='true' ]; then
notice "非ACTION模式, 设置镜像源"
npm set registry https://r.npm.taobao.org # 注册模块镜像 npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像 npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加 ## 以下选择添加
@ -20,12 +28,11 @@ then
npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium # selenium 二进制包镜像 npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium # selenium 二进制包镜像
npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector # node-inspector 二进制包镜像 npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector # node-inspector 二进制包镜像
# npm cache clean --force # 清空缓存 # npm cache clean --force # 清空缓存
fi fi
# ls -l # ls -l
# cat /etc/passwd # cat /etc/passwd
exec gosu node docker/entrypoint exec gosu user docker/entrypoint
fi fi

View File

@ -27,4 +27,7 @@ cd /workspace
rm -rf node nwjs package.nw rm -rf node nwjs package.nw
# #
# exec ./tools/rebuild-node-modules 0.53.1 # exec ./tools/rebuild-node-modules 0.53.1
exec ./tools/setup-wechat-devtools-bash ./tools/setup-wechat-devtools-bash
chmod -R 777 tmp node nwjs package.nw
ls -l package.nw

View File

@ -1,13 +0,0 @@
version: "3"
services:
wechat_devtools:
image: jiyecafe/wechat-devtools-build:v1
# build:
# context: ./docker
# dockerfile: Dockerfile
environment:
- NO_WINE=${NO_WINE:-true}
- BUILD_VERSION=${BUILD_VERSION:-v0}
volumes:
- ./../../:/workspace
entrypoint: /workspace/res/deb/docker/docker-entrypoint

View File

@ -1,30 +0,0 @@
FROM debian:9.13-slim
WORKDIR /workspace
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
mkdir -p /build_temp/python36 /build_temp/nodejs && \
apt update && \
apt install -y binutils software-properties-common gcc g++ \
gconf2 libxkbfile-dev p7zip-full make libssh2-1-dev libkrb5-dev wget \
openssl pkg-config build-essential && \
cd /build_temp/python36 && \
apt-get install -y aptitude &&\
aptitude -y install gcc make zlib1g-dev libffi-dev libssl-dev &&\
mkdir -p test && cd test &&\
wget http://npm.taobao.org/mirrors/python/3.6.5/Python-3.6.5.tgz &&\
tar -xvf Python-3.6.5.tgz &&\
chmod -R +x Python-3.6.5 &&\
cd Python-3.6.5/ &&\
./configure &&\
aptitude -y install libffi-dev libssl-dev &&\
make && make install &&\
cd /build_temp/nodejs &&\
wget https://deb.nodesource.com/setup_16.x &&\
chmod +x setup_16.x &&\
./setup_16.x &&\
apt-get install -y nodejs &&\
rm -rf /build_temp && \
apt install -y gosu

View File

@ -1,59 +0,0 @@
#!/bin/bash
# set -e
notice() {
echo -e "\033[36m $1 \033[0m "
}
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC
strings /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_2.2
# gcc -v
# g++ -v
# cc -v
# node --version
# python --version
# python3 --version
echo "=============="
cd /workspace
# mkdir -p tmp/test/node_modules
# cd tmp/test
# npm install nodegit
# tail -f /etc/issue
./tools/setup-wechat-devtools-bash
############ 构建deb包 ################
root_dir=$(cd `dirname $0`/../../.. && pwd -P)
echo "root_dir: $root_dir"
tmp_dir="$root_dir/tmp"
app_dir="$root_dir/tmp/deb"
# Remove any previous build
rm -rf $app_dir
# Make usr and icons dirs
notice "Make Dirs"
mkdir -p $app_dir/opt/wechat-devtools/bin
mkdir -p $app_dir/usr/{src,bin}
mkdir -p $app_dir/usr/share/{metainfo,icons,applications}
notice "COPY Files"
cp -r "$root_dir/res/deb/data"/* $app_dir
cp "$root_dir/bin/wechat-devtools" "$app_dir/opt/wechat-devtools/bin"
cp "$root_dir/res/deb.desktop" "$app_dir/usr/share/applications/wechat-devtools.desktop"
if [[ ! $BUILD_VERSION -eq 'continuous' ]];then
sed -i "s/BUILD_VERSION/${BUILD_VERSION//v/}/" "$app_dir/DEBIAN/control"
else
sed -i "s/BUILD_VERSION/0/" "$app_dir/DEBIAN/control"
fi
cp "$root_dir/res/icons/wechat-devtools.png" "$app_dir/usr/share/icons/wechat-devtools.png"
cp -r "$root_dir/package.nw" "$app_dir/opt/wechat-devtools/package.nw"
cp -r "$root_dir/nwjs" "$app_dir/opt/wechat-devtools/nwjs"
rm -rf "$app_dir/opt/wechat-devtools/nwjs"/{node,node.exe}
cp "$root_dir/node/bin/node" "$app_dir/opt/wechat-devtools/nwjs/node"
cd "$app_dir/opt/wechat-devtools/nwjs/" && ln -s "node" "node.exe"
notice "BUILD DEB Package"
cd "$root_dir/tmp/deb"
ls -l "$root_dir/tmp/deb"
dpkg-deb -b . "WeChat_Dev_Tools_$BUILD_VERSION.deb"

View File

@ -1,32 +0,0 @@
#!/bin/bash
export ARCH=x86_64
root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp"
app_dir="$root_dir/tmp/AppDir"
# Remove any previous build
rm -rf $app_dir
# Make usr and icons dirs
mkdir -p $app_dir/bin
mkdir -p $app_dir/usr/{src,bin}
mkdir -p $app_dir/usr/share/{metainfo,icons}
cp "$root_dir/bin/wechat-devtools" "$app_dir/bin/wechat-devtools"
cp "$root_dir/res/appimage.desktop" "$app_dir/wechat-devtools.desktop"
cp "$root_dir/res/icons/wechat-devtools.png" "$app_dir/wechat-devtools.png"
cat > "$app_dir/AppRun" <<- EOF
#!/bin/bash
exec \$APPDIR/bin/wechat-devtools
EOF
chmod +x "$app_dir/AppRun"
cp -r "$root_dir/package.nw" "$app_dir/package.nw"
cp -r "$root_dir/nwjs" "$app_dir/nwjs"
rm -rf "$app_dir/nwjs/node" "$app_dir/nwjs/node.exe"
cp -r "$root_dir/node/bin/node" "$app_dir/nwjs/node"
cd "$app_dir/nwjs/" && ln -s "node" "node.exe"
cd "$app_dir"
# appimagetool $app_dir

65
tools/build-appimage.sh Executable file
View File

@ -0,0 +1,65 @@
#!/bin/bash
notice() {
echo -e "\033[36m $1 \033[0m "
}
if [ -z $VERSION ];then
export VERSION=$1
fi
if [ -z $ARCH ];then
export ARCH=$2
fi
if [[ $NO_WINE == 'true' ]];then
TYPE='no_wine'
else
TYPE='wine'
fi
root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp"
app_dir="$tmp_dir/AppDir"
build_dir="$tmp_dir/build"
notice "下载AppImage构建工具 ACTION_MODE:$ACTION_MODE"
if [[ $ACTION_MODE == 'false' ]]; then
appimagetool_host="download.fastgit.org"
else
appimagetool_host="github.com"
fi
if [ ! -f "$tmp_dir/appimagetool-x86_64.AppImage" ];then
wget "https://$appimagetool_host/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" \
-O "$tmp_dir/appimagetool-x86_64.AppImage"
fi
chmod a+x "$tmp_dir/appimagetool-x86_64.AppImage"
# Remove any previous build
rm -rf $app_dir
# Make usr and icons dirs
mkdir -p $app_dir/bin
mkdir -p $app_dir/usr/{src,bin}
mkdir -p $app_dir/usr/share/{metainfo,icons}
notice "COPY FILES"
cp "$root_dir/bin/wechat-devtools" "$app_dir/bin/wechat-devtools"
cp "$root_dir/res/appimage.desktop" "$app_dir/wechat-devtools.desktop"
cp "$root_dir/res/icons/wechat-devtools.png" "$app_dir/wechat-devtools.png"
cat > "$app_dir/AppRun" <<- EOF
#!/bin/bash
exec \$APPDIR/bin/wechat-devtools
EOF
chmod +x "$app_dir/AppRun"
cp -r "$root_dir/package.nw" "$app_dir/package.nw"
cp -r "$root_dir/nwjs" "$app_dir/nwjs"
rm -rf "$app_dir/nwjs/node" "$app_dir/nwjs/node.exe"
cp -r "$root_dir/node/bin/node" "$app_dir/nwjs/node"
cd "$app_dir/nwjs/" && ln -s "node" "node.exe"
cd "$app_dir"
# appimagetool $app_dir
notice "MAKE APPIMAGE"
"$tmp_dir/appimagetool-x86_64.AppImage" "$app_dir" "$build_dir/WeChat_Dev_Tools_${VERSION}_${ARCH}_${TYPE}.AppImage"
rm -rf $app_dir

View File

@ -1,4 +1,8 @@
#!/bin/bash #!/bin/bash
set -e
notice() {
echo -e "\033[36m $1 \033[0m "
}
root_dir=$(cd `dirname $0`/.. && pwd -P) root_dir=$(cd `dirname $0`/.. && pwd -P)
echo $BUILD_VERSION echo $BUILD_VERSION
@ -6,7 +10,40 @@ if [ -z "$BUILD_VERSION" ];then
export BUILD_VERSION=$1 export BUILD_VERSION=$1
fi fi
echo $BUILD_VERSION echo $BUILD_VERSION
cd $root_dir/res/deb
pwd ############ 构建deb包 ################
# docker-compose down root_dir=$(cd `dirname $0`/.. && pwd -P)
docker-compose up echo "root_dir: $root_dir"
tmp_dir="$root_dir/tmp"
app_dir="$root_dir/tmp/deb"
# Remove any previous build
rm -rf $app_dir
# Make usr and icons dirs
notice "Make Dirs"
mkdir -p $app_dir/opt/wechat-devtools/bin
mkdir -p $app_dir/usr/{src,bin}
mkdir -p $app_dir/usr/share/{metainfo,icons,applications}
notice "COPY Files"
cp -r "$root_dir/res/deb/data"/* $app_dir
cp "$root_dir/bin/wechat-devtools" "$app_dir/opt/wechat-devtools/bin"
cp "$root_dir/res/deb.desktop" "$app_dir/usr/share/applications/wechat-devtools.desktop"
if [[ ! $BUILD_VERSION -eq 'continuous' ]];then
sed -i "s/BUILD_VERSION/${BUILD_VERSION//v/}/" "$app_dir/DEBIAN/control"
else
sed -i "s/BUILD_VERSION/0/" "$app_dir/DEBIAN/control"
fi
cp "$root_dir/res/icons/wechat-devtools.png" "$app_dir/usr/share/icons/wechat-devtools.png"
cp -r "$root_dir/package.nw" "$app_dir/opt/wechat-devtools/package.nw"
cp -r "$root_dir/nwjs" "$app_dir/opt/wechat-devtools/nwjs"
rm -rf "$app_dir/opt/wechat-devtools/nwjs"/{node,node.exe}
cp "$root_dir/node/bin/node" "$app_dir/opt/wechat-devtools/nwjs/node"
cd "$app_dir/opt/wechat-devtools/nwjs/" && ln -s "node" "node.exe"
notice "BUILD DEB Package"
cd "$root_dir/tmp/deb"
ls -l "$root_dir/tmp/deb"
mkdir -p "$root_dir/tmp/build"
dpkg-deb -b . "$root_dir/tmp/build/WeChat_Dev_Tools_$BUILD_VERSION.deb"

View File

@ -4,9 +4,13 @@
set -e set -e
root_dir=$(cd `dirname $0`/.. && pwd -P) root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp" tmp_dir="$root_dir/tmp"
build_dir="$tmp_dir/build" if [ -z $VERSION ];then
version=$1 export VERSION=$1
ARCH=$2 fi
if [ -z $ARCH ];then
export ARCH=$2
fi
success() { success() {
echo -e "\033[42;37m 成功 \033[0m $1" echo -e "\033[42;37m 成功 \033[0m $1"
@ -19,58 +23,29 @@ fail() {
echo -e "\033[41;37m 失败 \033[0m $1" echo -e "\033[41;37m 失败 \033[0m $1"
} }
if [[ $version == '' ]];then if [[ $VERSION == '' ]];then
fail "请指定版本" fail "请指定版本"
exit 1 exit 1
elif [[ $ARCH == '' ]];then elif [[ $ARCH == '' ]];then
fail "请指定架构" fail "请指定架构"
exit 1 exit 1
fi fi
export ARCH=$ARCH
rm -rf "$build_dir"
mkdir -p "$build_dir"
notice "下载AppImage构建工具"
if [ $ACTION_MODE!='true' ]; then
appimagetool_host="github.com"
else
appimagetool_host="download.fastgit.org"
fi
wget "https://$appimagetool_host/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" \
-O "$tmp_dir/appimagetool-x86_64.AppImage"
chmod a+x "$tmp_dir/appimagetool-x86_64.AppImage"
for type in wine no_wine; do for type in wine no_wine; do
notice "当前构建类型: $type"; notice "当前构建类型: $type";
FULL_NAME="WeChat_Dev_Tools_${version}_${ARCH}_$type"
if [[ $type == 'no_wine' ]];then if [[ $type == 'no_wine' ]];then
notice "no wine handle" notice "no wine handle"
export NO_WINE=true export NO_WINE=true
bash "$root_dir/tools/fix-core.sh" "$root_dir/tools/fix-core.sh"
bash "$root_dir/tools/fix-other.sh" "$root_dir/tools/fix-other.sh"
fi fi
mkdir -p "$build_dir/$FULL_NAME"
# 构建压缩包 # 构建压缩包
notice "COPY bin" notice "BUILD Simple Package"
\cp -rf "$root_dir/bin" "$build_dir/$FULL_NAME/bin" "$root_dir/tools/build-tar.sh"
notice "COPY nwjs"
\cp -drf "$root_dir/nwjs" "$build_dir/$FULL_NAME/nwjs"
notice "COPY node"
rm -rf "$build_dir/$FULL_NAME/nwjs/node"
\cp -rf "$root_dir/node/bin/node" "$build_dir/$FULL_NAME/nwjs/node"
notice "COPY package.nw"
\cp -rf "$root_dir/package.nw" "$build_dir/$FULL_NAME/package.nw"
notice "MAKE tar.gz"
cd "$build_dir" && tar -zcf "$FULL_NAME.tar.gz" "$FULL_NAME"
# 构建AppImage # 构建AppImage
notice "BUILD AppImage" notice "BUILD AppImage"
bash "$root_dir/tools/appimage.sh" "$root_dir/tools/build-appimage.sh"
"$tmp_dir/appimagetool-x86_64.AppImage" "$root_dir/tmp/AppDir" "$build_dir/$FULL_NAME.AppImage"
# 删除构建资源
notice "DELETE Build Source"
rm -rf "$build_dir/$FULL_NAME"
done done

54
tools/build-tar.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
# 脚本执行前提已完成支持wine的基本构建
set -e
root_dir=$(cd `dirname $0`/.. && pwd -P)
tmp_dir="$root_dir/tmp"
store_dir="$tmp_dir/build"
mkdir -p $store_dir
if [ -z $VERSION ];then
export VERSION=$1
fi
if [ -z $ARCH ];then
export ARCH=$2
fi
success() {
echo -e "\033[42;37m 成功 \033[0m $1"
}
notice() {
echo -e "\033[36m $1 \033[0m "
}
fail() {
echo -e "\033[41;37m 失败 \033[0m $1"
}
if [[ $VERSION == '' ]];then
fail "请指定版本"
exit 1
elif [[ $ARCH == '' ]];then
fail "请指定架构"
exit 1
fi
if [[ $NO_WINE == 'true' ]];then
TYPE='no_wine'
else
TYPE='wine'
fi
build_dir="$tmp_dir/tar/WeChat_Dev_Tools_${VERSION}_${ARCH}_${TYPE}"
mkdir -p $build_dir
notice "COPY bin"
\cp -rf "$root_dir/bin" "$build_dir/bin"
notice "COPY nwjs"
\cp -drf "$root_dir/nwjs" "$build_dir/nwjs"
notice "COPY node"
rm -rf "$build_dir/nwjs/node"
\cp -rf "$root_dir/node/bin/node" "$build_dir/nwjs/node"
notice "COPY package.nw"
\cp -rf "$root_dir/package.nw" "$build_dir/package.nw"
notice "MAKE tar.gz"
cd "$tmp_dir/tar" && tar -zcf "$store_dir/WeChat_Dev_Tools_${VERSION}_${ARCH}_${TYPE}.tar.gz" "WeChat_Dev_Tools_${VERSION}_${ARCH}_${TYPE}"
rm -rf $build_dir

View File

@ -43,6 +43,7 @@ echo "nw-gyp version: $( nw-gyp --version )"
echo "node version: $(node --version )" echo "node version: $(node --version )"
echo "npm version: $(npm --version )" echo "npm version: $(npm --version )"
python --version python --version
python3 --version
rm -fr "${package_dir}/node_modules/vscode-windows-ca-certs" # the module is only available in windows rm -fr "${package_dir}/node_modules/vscode-windows-ca-certs" # the module is only available in windows
rm -fr "${package_dir}/node_modules/vscode-windows-registry" # the module is only available in windows rm -fr "${package_dir}/node_modules/vscode-windows-registry" # the module is only available in windows

View File

@ -14,7 +14,7 @@ const download = function () {
console.error(error) console.error(error)
} }
let url = process.env['ACTION'] === 'true'?nodeConfig["url-global"]:nodeConfig.url let url = process.env['ACTION_MODE'] === 'true'?nodeConfig["url-global"]:nodeConfig.url
url = url.replace("${version}", nodeConfig.version) url = url.replace("${version}", nodeConfig.version)
.replace("${version}", nodeConfig.version); .replace("${version}", nodeConfig.version);