update(actions)

This commit is contained in:
msojocs 2022-01-27 10:28:29 +08:00
parent 35f4dcd1bc
commit b64c5934f3
7 changed files with 71 additions and 16 deletions

55
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,55 @@
# 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
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
release:
types: [published]
push:
tags:
- v*
branches: [ master ]
# pull_request:
# branches: [ master ]
# # Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Build
run: |
pwd
ls -l
chmod 777 docker/entrypoint
chmod 777 tools/*
export ACTION_MODE=true
tools/setup-wechat-devtools-node
- name: Delete unused file
run: |
sudo rm -rf cache tmp
- name: Release
uses: fnkr/github-action-ghr@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GHR_COMPRESS: xz
GHR_PATH: /github/workspace
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,5 +1,6 @@
{
"description": "此处版本应与nwjs使用的node版本一致",
"version": "14.5.0",
"url": "https://npm.taobao.org/mirrors/node/v${version}/node-v${version}-linux-x64.tar.gz"
"url": "https://npm.taobao.org/mirrors/node/v${version}/node-v${version}-linux-x64.tar.gz",
"url-global": "https://nodejs.org/download/release/v${version}/node-v${version}-linux-x64.tar.gz"
}

View File

@ -1,7 +1,9 @@
version: "3"
services:
web:
wechat_devtools:
image: node:16.13.1
volumes:
- .:/workspace
environment:
- ACTION=${ACTION_MODE:-false}
entrypoint: /workspace/docker/entrypoint

View File

@ -36,12 +36,10 @@ echo "\
apt-get clean; # 清空缓存
apt-get update; # 更新
apt-get install -y libx11-dev libxkbfile-dev
apt-get install -y libx11-dev libxkbfile-dev p7zip-full
hash node-gyp 2>/dev/null || {
echo >&2 "I require node-gyp but it's not installed. Installing.";
npm install -g node-gyp
}
npm install -g node-gyp
node-gyp install
node-gyp list
@ -55,10 +53,5 @@ node-gyp list
# end test
cd /workspace
hash 7z 2>/dev/null || {
echo >&2 "I require 7z but it's not installed. Installing.";
apt-get update
apt-get install p7zip-full -y
}
export https_proxy="http://192.168.249.236:7890"
# export https_proxy="http://192.168.249.236:7890"
exec ./tools/setup-wechat-devtools-bash

2
test/env Normal file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env node
console.log(process.env['action']==='true')

View File

@ -5,16 +5,18 @@ const { spawn } = require("child_process");
const parseFile = function (path) {
console.log("fix start")
if (!fs.existsSync(path)) {
return;
}
console.log("content")
let content = JSON.parse(fs.readFileSync(path, "utf8"));
content.name = "wechat_devtools";
// 开启调试,更新参数
content['chromium-args'] = content['chromium-args'].replace('--disable-devtools', '').replace('--ignore-gpu-blacklist', '--ignore-gpu-blocklist')
console.log("arite")
fs.writeFileSync(path, JSON.stringify(content, null, 4));
};

View File

@ -13,8 +13,8 @@ const download = function () {
fs.mkdirSync(path.resolve(__dirname, "../cache"));
} catch (error) {}
let url = nodeConfig.url
.replace("${version}", nodeConfig.version)
let url = process.env['ACTION'] === 'true'?nodeConfig["url-global"]:nodeConfig.url
url = url.replace("${version}", nodeConfig.version)
.replace("${version}", nodeConfig.version);
let localPath = path.resolve(