🎨 Refactoring action packaging logic
This commit is contained in:
2
.github/workflows/pake-cli.yaml
vendored
2
.github/workflows/pake-cli.yaml
vendored
@@ -117,7 +117,7 @@ jobs:
|
|||||||
|
|
||||||
- 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.js
|
||||||
env:
|
env:
|
||||||
URL: ${{ inputs.url }}
|
URL: ${{ inputs.url }}
|
||||||
NAME: ${{ inputs.name }}
|
NAME: ${{ inputs.name }}
|
||||||
|
|||||||
8
.github/workflows/pake_build_single_app.yaml
vendored
8
.github/workflows/pake_build_single_app.yaml
vendored
@@ -71,14 +71,14 @@ jobs:
|
|||||||
toolchain: ${{ matrix.rust }}
|
toolchain: ${{ matrix.rust }}
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: install dependencies (ubuntu only)
|
- name: Install dependencies (ubuntu only)
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
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: rust cache restore
|
- name: Rust cache restore
|
||||||
id: cache_store
|
id: cache_store
|
||||||
uses: actions/cache/restore@v3
|
uses: actions/cache/restore@v3
|
||||||
with:
|
with:
|
||||||
@@ -98,7 +98,7 @@ jobs:
|
|||||||
URL: ${{ inputs.url }}
|
URL: ${{ inputs.url }}
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
node ./script/build_with_pake_cli.mjs
|
node ./script/build_with_pake_cli.js
|
||||||
|
|
||||||
- name: Build for Ubuntu
|
- name: Build for Ubuntu
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
@@ -129,7 +129,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git checkout -- src-tauri/Cargo.lock
|
git checkout -- src-tauri/Cargo.lock
|
||||||
|
|
||||||
- name: rust cache store
|
- name: Rust cache store
|
||||||
uses: actions/cache/save@v3
|
uses: actions/cache/save@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import pakeJson from '../src-tauri/pake.json' assert { type: 'json' };
|
import { writeFileSync, existsSync, copyFileSync, readFileSync } from 'fs';
|
||||||
import tauriJson from '../src-tauri/tauri.conf.json' assert { type: 'json' };
|
|
||||||
import windowsJson from '../src-tauri/tauri.windows.conf.json' assert { type: 'json' };
|
|
||||||
import macosJson from '../src-tauri/tauri.macos.conf.json' assert { type: 'json' };
|
|
||||||
import linuxJson from '../src-tauri/tauri.linux.conf.json' assert { type: 'json' };
|
|
||||||
|
|
||||||
import { writeFileSync, existsSync, copyFileSync } from 'fs';
|
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
|
const pakeJson = JSON.parse(readFileSync('../src-tauri/pake.json', 'utf-8'));
|
||||||
|
const tauriJson = JSON.parse(readFileSync('../src-tauri/tauri.conf.json', 'utf-8'));
|
||||||
|
const windowsJson = JSON.parse(readFileSync('../src-tauri/tauri.windows.conf.json', 'utf-8'));
|
||||||
|
const macosJson = JSON.parse(readFileSync('../src-tauri/tauri.macos.conf.json', 'utf-8'));
|
||||||
|
const linuxJson = JSON.parse(readFileSync('../src-tauri/tauri.linux.conf.json', 'utf-8'));
|
||||||
|
|
||||||
const desktopEntry = `[Desktop Entry]
|
const desktopEntry = `[Desktop Entry]
|
||||||
Encoding=UTF-8
|
Encoding=UTF-8
|
||||||
Categories=Office
|
Categories=Office
|
||||||
@@ -55,8 +55,7 @@ const variables = {
|
|||||||
hdIconPath: `src-tauri/png/${process.env.NAME}_256.ico`,
|
hdIconPath: `src-tauri/png/${process.env.NAME}_256.ico`,
|
||||||
hdDefaultPath: 'src-tauri/png/icon_256.ico',
|
hdDefaultPath: 'src-tauri/png/icon_256.ico',
|
||||||
icon: [`png/${process.env.NAME}_256.ico`, `png/${process.env.NAME}_32.ico`],
|
icon: [`png/${process.env.NAME}_256.ico`, `png/${process.env.NAME}_32.ico`],
|
||||||
resources: [`png/${process.env.NAME}_32.ico`]
|
resources: [`png/${process.env.NAME}_32.ico`],
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -82,12 +81,11 @@ switch (os.platform()) {
|
|||||||
case 'win32':
|
case 'win32':
|
||||||
platformConfig = windowsJson;
|
platformConfig = windowsJson;
|
||||||
platformVariables = variables.windows;
|
platformVariables = variables.windows;
|
||||||
updateResources()
|
updateResources();
|
||||||
updateIconFile(platformVariables.hdIconPath, platformVariables.hdDefaultPath);
|
updateIconFile(platformVariables.hdIconPath, platformVariables.hdDefaultPath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateIconFile(platformVariables.iconPath, platformVariables.defaultIconPath);
|
updateIconFile(platformVariables.iconPath, platformVariables.defaultIconPath);
|
||||||
|
|
||||||
updatePlatformConfig(platformConfig, platformVariables);
|
updatePlatformConfig(platformConfig, platformVariables);
|
||||||
@@ -149,7 +147,6 @@ function updatePlatformConfig(platformConfig, platformVariables) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
|
|
||||||
writeFileSync(variables.pakeConfigPath, JSON.stringify(pakeJson, null, 2));
|
writeFileSync(variables.pakeConfigPath, JSON.stringify(pakeJson, null, 2));
|
||||||
writeFileSync(variables.tauriConfigPath, JSON.stringify(tauriJson, null, 2));
|
writeFileSync(variables.tauriConfigPath, JSON.stringify(tauriJson, null, 2));
|
||||||
|
|
||||||
@@ -159,16 +156,15 @@ function save() {
|
|||||||
writeFileSync(variables.macos.configFilePath, JSON.stringify(macosJson, null, 2));
|
writeFileSync(variables.macos.configFilePath, JSON.stringify(macosJson, null, 2));
|
||||||
|
|
||||||
writeFileSync(variables.windows.configFilePath, JSON.stringify(windowsJson, null, 2));
|
writeFileSync(variables.windows.configFilePath, JSON.stringify(windowsJson, null, 2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateDesktopEntry() {
|
function updateDesktopEntry() {
|
||||||
linuxJson.tauri.bundle.deb.files = {};
|
linuxJson.tauri.bundle.deb.files = {};
|
||||||
linuxJson.tauri.bundle.deb.files[variables.linux.desktopEntryConfig.configKey] =
|
linuxJson.tauri.bundle.deb.files[variables.linux.desktopEntryConfig.configKey] =
|
||||||
variables.linux.desktopEntryConfig.configValue;
|
variables.linux.desktopEntryConfig.configValue;
|
||||||
writeFileSync(variables.linux.desktopEntryPath, variables.linux.desktopEntry);
|
writeFileSync(variables.linux.desktopEntryPath, variables.linux.desktopEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateResources(){
|
function updateResources() {
|
||||||
windowsJson.tauri.bundle.resources = variables.windows.resources;
|
windowsJson.tauri.bundle.resources = variables.windows.resources;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user