Skip to content
代码片段 群组 项目
提交 52ba4b4d 编辑于 作者: Jing Teng's avatar Jing Teng
浏览文件

ensure apack.json is packaged within linux/mac/win .zip files + unit test.

上级 762fae46
No related branches found
No related tags found
无相关合并请求
......@@ -98,34 +98,58 @@ jobs:
id: linux_apack_setup
if: startsWith(matrix.os, 'ubuntu')
run: |
echo "::set-output name=linux::$(./node_modules/7zip-bin/linux/x64/7za l ./dist/*linux.zip | grep ' apack.json')"
- name: Verify apack.json exists in Linux .zip package
echo "::set-output name=linuxBaseDir::$(./node_modules/7zip-bin/linux/x64/7za l ./dist/*linux.zip | grep apack.json)"
echo "::set-output name=linuxAsarDir::$(npx asar l ./dist/linux-unpacked/resources/app.asar | grep apack.json)"
- name: Verify apack.json exists in Linux package .zip package
uses: nick-fields/assert-action@v1
if: startsWith(matrix.os, 'ubuntu')
with:
expected: ' apack.json'
actual: ${{ steps.linux_apack_setup.outputs.linux }}
expected: 'apack.json'
actual: ${{ steps.linux_apack_setup.outputs.linuxBaseDir }}
comparison: contains
- name: Verify apack.json exists in Linux package .zip package's app.asar archive
uses: nick-fields/assert-action@v1
if: startsWith(matrix.os, 'ubuntu')
with:
expected: 'apack.json'
actual: ${{ steps.linux_apack_setup.outputs.linuxAsarDir }}
comparison: contains
- name: Setup macOS/Windows package for adapter pack test
id: nonlinux_apack_setup
if: startsWith(matrix.os, 'macos')
run: |
echo "::set-output name=win::$(./node_modules/7zip-bin/mac/x64/7za l dist/*win.zip | grep ' apack.json')"
echo "::set-output name=mac::$(./node_modules/7zip-bin/mac/x64/7za l dist/*mac.zip | grep ' apack.json')"
echo "::set-output name=winBaseDir::$(./node_modules/7zip-bin/mac/x64/7za l dist/*win.zip | grep apack.json)"
echo "::set-output name=winAsarDir::$(npx asar l ./dist/win-unpacked/resources/app.asar | grep apack.json)"
echo "::set-output name=macBaseDir::$(./node_modules/7zip-bin/mac/x64/7za l dist/*mac.zip | grep apack.json)"
echo "::set-output name=macAsarDir::$(npx asar l ./dist/mac/zap.app/Contents/Resources/app.asar | grep apack.json)"
- name: Verify apack.json exists in Windows .zip package
uses: nick-fields/assert-action@v1.1.0
if: startsWith(matrix.os, 'macos')
with:
expected: ' apack.json'
actual: ${{ steps.nonlinux_apack_setup.outputs.win }}
expected: 'apack.json'
actual: ${{ steps.nonlinux_apack_setup.outputs.winBaseDir }}
comparison: contains
- name: Verify apack.json exists in Windows .zip package's app.asar archive
uses: nick-fields/assert-action@v1.1.0
if: startsWith(matrix.os, 'macos')
with:
expected: 'apack.json'
actual: ${{ steps.nonlinux_apack_setup.outputs.winAsarDir }}
comparison: contains
- name: Verify apack.json exists in macOS .zip package
uses: nick-fields/assert-action@v1.1.0
if: startsWith(matrix.os, 'macos')
with:
expected: ' apack.json'
actual: ${{ steps.nonlinux_apack_setup.outputs.mac }}
expected: 'apack.json'
actual: ${{ steps.nonlinux_apack_setup.outputs.macBaseDir }}
comparison: contains
- name: Verify apack.json exists in macOS .zip package's app.asar archive
uses: nick-fields/assert-action@v1.1.0
if: startsWith(matrix.os, 'macos')
with:
expected: 'apack.json'
actual: ${{ steps.nonlinux_apack_setup.outputs.macAsarDir }}
comparison: contains
- name: Archive Windows .zip file
......
......@@ -194,7 +194,8 @@
"build": {
"appId": "zap.id",
"artifactName": "${productName}-${os}.${ext}",
"afterAllArtifactBuild": "./src-script/pack-apack.js",
"afterPack": "./src-script/pack-apack-win-linux.js",
"afterAllArtifactBuild": "./src-script/pack-apack-mac.js",
"mac": {
"category": "public.app-category.developer-tools",
"darkModeSupport": true,
......
......@@ -6,12 +6,7 @@ const pathTo7zip = sevenBin.path7za
exports.default = async function (buildResult) {
buildResult?.artifactPaths?.forEach((element) => {
if (
(element.includes('mac') ||
element.includes('win') ||
element.includes('linux')) &&
element.endsWith('.zip')
) {
if (element.includes('mac') && element.endsWith('.zip')) {
const myStream = Seven.add(
element,
path.join(buildResult.outDir, '../apack.json'),
......
const scriptUtil = require('./script-util.js')
const path = require('path')
exports.default = async function (context) {
if (
context.electronPlatformName === 'win' ||
context.electronPlatformName === 'linux'
) {
return scriptUtil.executeCmd({}, 'npx', [
'copyfiles',
'-V',
'-u',
'5',
path.resolve(context.outDir, '../apack.json'),
context.appOutDir,
])
}
}
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册