From 458761d00861ed232b23145f3d5484895590dc21 Mon Sep 17 00:00:00 2001 From: Gaurav Khanna Date: Tue, 28 May 2024 17:07:26 -0700 Subject: [PATCH] add permission to write --- .github/workflows/release-cli.yml | 3 +++ cli/warpdive/install.js | 6 ++++-- cli/warpdive/package.json | 15 --------------- 3 files changed, 7 insertions(+), 17 deletions(-) delete mode 100644 cli/warpdive/package.json diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index e57447e..229c82c 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -3,6 +3,9 @@ name: release cli env: BUILD_PATH: './cli/' +permissions: + contents: write + on: release: types: [published] diff --git a/cli/warpdive/install.js b/cli/warpdive/install.js index 4962d4d..5a408d7 100644 --- a/cli/warpdive/install.js +++ b/cli/warpdive/install.js @@ -2,6 +2,7 @@ const fs = require('fs') const path = require('path') const zlib = require('zlib') const https = require('https') +const packageJson = require('./package.json') // Lookup table for all platforms and binary distribution packages const BINARY_DISTRIBUTION_PACKAGES = { @@ -14,10 +15,11 @@ const BINARY_DISTRIBUTION_PACKAGES = { } // Adjust the version you want to install. You can also make this dynamic. -const BINARY_DISTRIBUTION_VERSION = '1.0.0' +// const BINARY_DISTRIBUTION_VERSION = '1.0.0' +const BINARY_DISTRIBUTION_VERSION = packageJson.version // Windows binaries end with .exe so we need to special case them. -const binaryName = process.platform === 'win32' ? 'my-binary.exe' : 'my-binary' +const binaryName = process.platform === 'win32' ? 'warpdive.exe' : 'warpdive' // Determine package name for this platform const platformSpecificPackageName = BINARY_DISTRIBUTION_PACKAGES[`${process.platform}-${process.arch}`] diff --git a/cli/warpdive/package.json b/cli/warpdive/package.json deleted file mode 100644 index 6f6f8c7..0000000 --- a/cli/warpdive/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "my-package", - "version": "1.0.0", - "bin": { - "my-package": "bin/cli" - }, - "scripts": { - "postinstall": "node ./install.js" - }, - "optionalDependencies": { - "my-package-linux-x64": "1.0.0", - "my-package-linux-arm": "1.0.0", - "my-package-windows-x64": "1.0.0" - } -}