Merge pull request #147 from MuhammedKalkan/switch-to-nx

Run nx instead yarn
This commit is contained in:
Muhammed Kalkan 2023-05-30 00:25:27 +03:00 committed by GitHub
commit 2ef129c6d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 25 deletions

View File

@ -21,11 +21,11 @@ jobs:
- name: Export version to variable
run: |
export LENS_VERSION=$(cat version)
echo "LENS_VERSION=$LENS_VERSION" >> $GITHUB_ENV
echo "LENS_VERSION=$LENS_VERSION" >> $GITHUB_ENV
shell: bash
- uses: actions/setup-node@v3
with:
node-version: 16.19.0
node-version: "16.x"
- name: Checkout Upstream Lens
uses: actions/checkout@v3
with:
@ -42,6 +42,12 @@ jobs:
if [ "$RUNNER_OS" == "Windows" ]; then
choco install visualstudio2019buildtools visualstudio2019-workload-vctools
fi
npm run all:install
# Avoid npm install from electron-builder
# ref: https://github.com/electron-userland/electron-builder/blob/80a3ae857b9305aff1774e1b2b932601af50231b/packages/app-builder-lib/src/util/yarn.ts#L11-L16
mkdir open-lens/node_modules
if [ "$RUNNER_OS" == "macOS" ]; then
if [ "${CSC_LINK}" = "" ]; then
unset CSC_LINK
@ -50,10 +56,9 @@ jobs:
if [ "${CSC_KEY_PASSWORD}" = "" ]; then
unset CSC_KEY_PASSWORD
fi
echo "DOWNLOAD_ALL_ARCHITECTURES=true" >> $GITHUB_ENV
yarn run all:install
yarn run build
yarn run build:app
npx nx run open-lens:build:app --x64 --arm64
for file in open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.dmg; do
if [[ "$file" == *"arm64"* ]]; then
cp "$file" releasefiles/OpenLens-${{ env.LENS_VERSION }}-arm64.dmg
@ -69,10 +74,7 @@ jobs:
fi
done
elif [ "$RUNNER_OS" == "Linux" ]; then
echo "DOWNLOAD_ALL_ARCHITECTURES=true" >> $GITHUB_ENV
yarn run all:install
yarn run build
yarn run build:app
npx nx run open-lens:build:app --x64 --arm64
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.x86_64.AppImage releasefiles/OpenLens-${{ env.LENS_VERSION }}.AppImage
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.amd64.deb releasefiles/OpenLens-${{ env.LENS_VERSION }}.deb
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.x86_64.rpm releasefiles/OpenLens-${{ env.LENS_VERSION }}.rpm
@ -80,9 +82,8 @@ jobs:
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.arm64.deb releasefiles/OpenLens-${{ env.LENS_VERSION }}.arm64.deb
cp open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.aarch64.rpm releasefiles/OpenLens-${{ env.LENS_VERSION }}.arm64.rpm
else
yarn run all:install
yarn run build
yarn run build:app
unset DOWNLOAD_ALL_ARCHITECTURES
npx nx run open-lens:build:app
cp open-lens/dist/OpenLens*.exe releasefiles/OpenLens-${{ env.LENS_VERSION }}.exe
cp open-lens/dist/OpenLens*.exe open-lens/dist/OpenLens-${{ env.LENS_VERSION }}.exe
fi
@ -99,6 +100,7 @@ jobs:
WIN_CSC_LINK: ${{ secrets.CSC_LINK_WIN }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD_WIN }}
CSC_FOR_PULL_REQUEST: true
DOWNLOAD_ALL_ARCHITECTURES: true
- name: Calculate SHA256 checksum
run: |

View File

@ -8,17 +8,6 @@ packagejson.build.publish = [{
}];
packagejson.build.win.artifactName = "OpenLens.Setup.${version}.${ext}";
if (process.platform != "win32") {
// build both x86_64 and arm64 for Linux and Darwin
packagejson.scripts['build:app'] = "electron-builder --publish onTag --x64 --arm64";
}
packagejson.build.npmRebuild = true;
fs.writeFileSync('./lens/open-lens/package.json', JSON.stringify(packagejson));
let npmrc = fs.readFileSync('./lens/.npmrc','utf-8');
npmrc = npmrc.replace("disturl \"","disturl = \"")
npmrc = npmrc.replace("target \"","target = \"")
npmrc = npmrc.replace("runtime \"","runtime = \"")
fs.writeFileSync('./lens/.npmrc',npmrc)