diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e3995c..5ee9e07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: push: tags: - v* - branches: [ master, dev] + branches: [ master, dev, 45-snap-version] pull_request: branches: [ master ] # # Allows you to run this workflow manually from the Actions tab @@ -328,6 +328,37 @@ jobs: name: wechat-devtools-${{ matrix.ARCH }}.build path: tmp/build + build-snap: + name: Build Snap Package + runs-on: ubuntu-18.04 + timeout-minutes: 30 + strategy: + matrix: + ARCH: ['x86_64'] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v1 + with: + use_lxd: true + + # You can now run Snapcraft shell commands + - name: Build snap + run: sg lxd -c 'snapcraft --use-lxd' + + - name: move file + run: | + mkdir -p tmp/build + mv *.snap tmp/build + - name: Upload artifact + uses: actions/upload-artifact@v2.3.1 + with: + # Artifact name + name: wechat-devtools-${{ matrix.ARCH }}.build + path: tmp/build + upload: name: Create release and upload artifacts needs: @@ -362,7 +393,7 @@ jobs: run: | wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage chmod +x pyuploadtool-x86_64.AppImage - ./pyuploadtool-x86_64.AppImage **build/WeChat*.AppImage **build/*.tar.gz **build/*.deb **build/*.pkg.* + ./pyuploadtool-x86_64.AppImage **build/WeChat*.AppImage **build/*.tar.gz **build/*.deb **build/*.pkg.* **build/*.snap - name: Release uses: softprops/action-gh-release@v1 @@ -376,4 +407,5 @@ jobs: **build/WeChat*.AppImage **build/*.tar.gz **build/*.deb - **build/*.pkg.* \ No newline at end of file + **build/*.pkg.* + **build/*.snap \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index 6a35ec2..2ab12eb 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -11,10 +11,18 @@ VERSION_DATA=(${VERSION_DATA//,/ }) TARGET_VERSION=${VERSION_DATA[0]} TARGET_VERSION_MD5=${VERSION_DATA[1]} -# 获取snapcraft中的版本号 +# 检查snapcraft主版本号是否正确 SNAP_VERSION=$(find $root_dir/snap -name "snapcraft.yaml" | xargs grep -P "'\d+\.\d+\.\d{5,}" -o) - -if [ "$SNAP_VERSION" != "'$TARGET_VERSION" ];then - echo "SNAP版本不匹配!!!" +if [ "${SNAP_VERSION//\'/}" != "$TARGET_VERSION" ];then + echo "SNAP版本不匹配!!!" + echo "SNAP版本: $SNAP_VERSION != 目标版本: $TARGET_VERSION" + exit 1 +fi + +# 检查snapcraft构建时下载的工具版本号是否正确 +SNAP_DEVTOOL_VERSION=$(find $root_dir/snap -name "snapcraft.yaml" | xargs grep -P "=\d+\d+\d{5,}" -o) +if [ "${SNAP_DEVTOOL_VERSION//=/}" != "${TARGET_VERSION//./}" ];then + echo "SNAP工具版本不匹配!!!" + echo "snap下载版本: ${SNAP_DEVTOOL_VERSION//=/} != 目标版本: ${TARGET_VERSION//./}" exit 1 fi diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e3e0022..9334e4a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -32,8 +32,8 @@ parts: ls -l $SNAPCRAFT_PART_INSTALL package-nw: plugin: dump - source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052203070&version_type=1 - # source: cache/wechat_devtools_1.05.2203070_x64.exe + source: https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1052204180&version_type=1 + # source: cache/wechat_devtools_1.05.2204180_x64.exe source-type: 7z source-subdir: code override-build: |