1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Seamless-Updates - generated latest-mac-arm64.yml (#10982)

This commit is contained in:
Alice 2024-09-04 14:11:17 +03:00 committed by GitHub
parent 01412b4500
commit 4e8316a6ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 26 deletions

View File

@ -44,6 +44,14 @@ jobs:
with:
python-version: '3.11'
- name: Set Publish Flag
run: |
if [[ $GIT_TAG_NAME = v* ]]; then
echo "PUBLISH_ENABLED=true" >> $GITHUB_ENV
else
echo "PUBLISH_ENABLED=false" >> $GITHUB_ENV
fi
- name: Build macOS M1 app
env:
APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }}
@ -56,6 +64,7 @@ jobs:
GH_REPO: ${{ github.repository }}
IS_CONTINUOUS_INTEGRATION: 1
BUILD_SEQUENCIAL: 1
PUBLISH_ENABLED: ${{ env.PUBLISH_ENABLED }}
run: |
export npm_config_arch=arm64
export npm_config_target_arch=arm64
@ -67,7 +76,7 @@ jobs:
npm pkg set 'build.mac.target[1].target'='zip'
npm pkg set 'build.mac.target[1].arch[0]'='arm64'
if [[ $GIT_TAG_NAME = v* ]]; then
if [[ "$PUBLISH_ENABLED" == "true" ]]; then
echo "Building and publishing desktop application..."
PYTHON_PATH=$(which python) USE_HARD_LINKS=false yarn dist --mac --arm64

View File

@ -31,8 +31,34 @@ const generateChecksumFile = () => {
return [sha512FilePath];
};
const renameLatestYmlFile = () => {
if (os.platform() === 'darwin' && process.arch === 'arm64') {
// latest-mac.yml is only generated when publishing.
if (process.env.PUBLISH_ENABLED === 'false') {
/* eslint-disable no-console */
console.info(`Publishing not enabled - skipping renaming latest-mac.yml file for arm64 architecture. process.env.PUBLISH_ENABLED = ${process.env.PUBLISH_ENABLED}`);
return;
}
/* eslint-disable no-console */
console.info('Renaming latest-mac.yml file...');
const latestMacFilePath = path.join(distPath, 'latest-mac.yml');
const renamedMacFilePath = path.join(distPath, 'latest-mac-arm64.yml');
if (fs.existsSync(latestMacFilePath)) {
/* eslint-disable no-console */
console.info('Renamed latest-mac.yml file to latest-mac-arm64.yml succesfully!');
fs.renameSync(latestMacFilePath, renamedMacFilePath);
return [renamedMacFilePath];
} else {
throw new Error('latest-mac.yml not found!');
}
}
};
const mainHook = () => {
generateChecksumFile();
renameLatestYmlFile();
};
exports.default = mainHook;

View File

@ -1,25 +0,0 @@
const fs = require('fs');
const path = require('path');
const os = require('os');
const distDirName = 'dist';
const distPath = path.join(__dirname, distDirName);
const renameLatestYmlFile = () => {
if (os.platform() === 'darwin' && process.arch === 'arm64') {
const latestMacFilePath = path.join(distPath, 'latest-mac.yml');
const renamedMacFilePath = path.join(distPath, 'latest-mac-arm64.yml');
if (fs.existsSync(latestMacFilePath)) {
fs.renameSync(latestMacFilePath, renamedMacFilePath);
return [renamedMacFilePath];
} else {
throw new Error('latest-mac.yml not found!');
}
}
};
const mainHook = () => {
renameLatestYmlFile();
};
exports.default = mainHook;