🎨 Output is more standardized

This commit is contained in:
Tw93
2023-08-28 17:41:28 +08:00
parent 02e44406a8
commit 1a0d4238c2
3 changed files with 113 additions and 115 deletions

View File

@@ -56,49 +56,49 @@ jobs:
fail-fast: false fail-fast: false
steps: steps:
- name: checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: install node - name: Install node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: 18
- name: install Rust for ubuntu-20.04 - name: Install Rust for ubuntu-20.04
if: inputs.platform == 'ubuntu-20.04' if: inputs.platform == 'ubuntu-20.04'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: stable
target: x86_64-unknown-linux-musl target: x86_64-unknown-linux-musl
- name: install Rust for windows-latest - name: Install Rust for windows-latest
if: inputs.platform == 'windows-latest' if: inputs.platform == 'windows-latest'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable-x86_64-msvc toolchain: stable-x86_64-msvc
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
- name: install Rust for macos-latest - name: Install Rust for macos-latest
if: inputs.platform == 'macos-latest' if: inputs.platform == 'macos-latest'
uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
with: with:
toolchain: stable toolchain: stable
target: x86_64-apple-darwin target: x86_64-apple-darwin
- name: install dependencies (ubuntu only) - name: Install dependencies (ubuntu only)
if: inputs.platform == 'ubuntu-20.04' if: inputs.platform == 'ubuntu-20.04'
uses: awalsh128/cache-apt-pkgs-action@latest uses: awalsh128/cache-apt-pkgs-action@latest
with: with:
packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
version: 1.1 version: 1.1
- name: install pake-cli local - name: Install pake-cli local
shell: bash shell: bash
run: | run: |
echo "install pake on local" echo "install pake on local"
npm install pake-cli npm install pake-cli
- name: rust cache restore - name: Rust cache restore
uses: actions/cache/restore@v3 uses: actions/cache/restore@v3
id: cache_store id: cache_store
with: with:
@@ -110,12 +110,12 @@ jobs:
node_modules/pake-cli/src-tauri/target/ node_modules/pake-cli/src-tauri/target/
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }} key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}
- name: install dependencies - name: Install dependencies
run: | run: |
npm install shelljs npm install shelljs
npm install axios npm install axios
- name: build with pake-cli - name: Build with pake-cli
run: | run: |
node ./script/build_with_pake_cli.mjs node ./script/build_with_pake_cli.mjs
env: env:
@@ -130,14 +130,14 @@ jobs:
MULTI_ARCH: ${{ inputs.multi_arch }} MULTI_ARCH: ${{ inputs.multi_arch }}
TARGETS: ${{ inputs.targets }} TARGETS: ${{ inputs.targets }}
- name: upload archive - name: Upload archive
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: output-${{ inputs.platform }}.zip name: output-${{ inputs.platform }}.zip
path: node_modules/pake-cli/output/* path: node_modules/pake-cli/output/*
retention-days: 3 retention-days: 3
- name: rust cache store - name: Rust cache store
uses: actions/cache/save@v3 uses: actions/cache/save@v3
if: steps.cache_store.outputs.cache-hit != 'true' if: steps.cache_store.outputs.cache-hit != 'true'
with: with:

View File

@@ -9,24 +9,22 @@ const { exec, cd, mv } = shelljs;
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename); const __dirname = dirname(__filename);
console.log("Welcome to use Pake Cli"); console.log('Welcome to use Pake Cli');
console.log("\n======================="); console.log('\n=======================');
console.log("build for app"); console.log('build for app');
console.log("Node.js info in your localhost ", process.version); console.log('Node.js info in your localhost ', process.version);
console.log("\n=======================\n"); console.log('\n=======================\n');
console.log('Pake parameters is: ');
console.log("\n======================="); console.log('url: ', process.env.URL);
console.log("pake parameters is: "); console.log('name: ', process.env.NAME);
console.log("url: ", process.env.URL); console.log('icon: ', process.env.ICON);
console.log("name: ", process.env.NAME); console.log('height: ', process.env.HEIGHT);
console.log("icon: ", process.env.ICON); console.log('width: ', process.env.WIDTH);
console.log("height: ", process.env.HEIGHT); console.log('transparent: ', process.env.TRANSPARENT);
console.log("width: ", process.env.WIDTH); console.log('resize: ', process.env.RESIZE);
console.log("transparent: ", process.env.TRANSPARENT); console.log('is multi arch? only for Mac: ', process.env.MULTI_ARCH);
console.log("resize: ", process.env.RESIZE); console.log('targets type? only for Linux: ', process.env.TARGETS);
console.log("is multi arch? only for Mac: ", process.env.MULTI_ARCH); console.log('===========================\n');
console.log("targets type? only for Linux: ", process.env.TARGETS);
console.log("===========================\n");
cd('node_modules/pake-cli'); cd('node_modules/pake-cli');
let params = `node cli.js ${process.env.URL} --name ${process.env.NAME}`; let params = `node cli.js ${process.env.URL} --name ${process.env.NAME}`;
@@ -36,7 +34,7 @@ if (process.env.ICON) {
axios({ axios({
method: 'get', method: 'get',
url: process.env.ICON, url: process.env.ICON,
responseType: 'stream' responseType: 'stream',
}).then(function (response) { }).then(function (response) {
response.data.pipe(fs.createWriteStream(iconPath)); response.data.pipe(fs.createWriteStream(iconPath));
params = `${params} --icon ${iconPath}`; params = `${params} --icon ${iconPath}`;
@@ -74,13 +72,13 @@ if (process.platform === 'darwin') {
params = `${params} --show-menu`; params = `${params} --show-menu`;
} }
console.log("Pake parameters is: ", params); console.log('Pake parameters is: ', params);
console.log("compile...."); console.log('Compile....');
exec(params); exec(params);
if (!fs.existsSync('output')) { if (!fs.existsSync('output')) {
fs.mkdirSync('output'); fs.mkdirSync('output');
} }
mv(`${process.env.NAME}.*`, 'output/'); mv(`${process.env.NAME}.*`, 'output/');
console.log("Build Success"); console.log('Build Success');
cd('../..'); cd('../..');