diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a6af95..07494c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,17 +90,21 @@ jobs: if [[ "${{ matrix.arch }}" == "x64" ]]; then mkdir -p ./bin/linux/x64 cp target/x86_64-unknown-linux-gnu/release/todoctor ./bin/linux/x64/todoctor + chmod +x ./bin/linux/x64/todoctor elif [[ "${{ matrix.arch }}" == "arm64" ]]; then mkdir -p ./bin/linux/arm64 cp target/aarch64-unknown-linux-gnu/release/todoctor ./bin/linux/arm64/todoctor + chmod +x ./bin/linux/arm64/todoctor fi elif [[ "${{ matrix.platform }}" == "macos-latest" ]]; then if [[ "${{ matrix.arch }}" == "x64" ]]; then mkdir -p ./bin/macos/x64 cp target/x86_64-apple-darwin/release/todoctor ./bin/macos/x64/todoctor + chmod +x ./bin/macos/x64/todoctor elif [[ "${{ matrix.arch }}" == "arm64" ]]; then mkdir -p ./bin/macos/arm64 cp target/aarch64-apple-darwin/release/todoctor ./bin/macos/arm64/todoctor + chmod +x ./bin/macos/arm64/todoctor fi fi shell: bash @@ -168,6 +172,20 @@ jobs: name: todoctor-windows-latest-x64 path: . + - name: Set Execute Permissions on Binaries + run: | + chmod +x ./bin/linux/x64/todoctor || true + chmod +x ./bin/linux/arm64/todoctor || true + chmod +x ./bin/macos/x64/todoctor || true + chmod +x ./bin/macos/arm64/todoctor || true + + - name: Verify Binary Permissions + run: | + ls -l ./bin/linux/x64/todoctor || true + ls -l ./bin/linux/arm64/todoctor || true + ls -l ./bin/macos/x64/todoctor || true + ls -l ./bin/macos/arm64/todoctor || true + - name: Create GitHub Release run: pnpm run ci:changelog env: diff --git a/bin/todoctor.js b/bin/todoctor.js index 263f27e..9518d27 100755 --- a/bin/todoctor.js +++ b/bin/todoctor.js @@ -32,9 +32,6 @@ let binaryPath = path.join(dirname, relativePath) if (!fs.existsSync(binaryPath)) { console.error(`Binary not found: ${binaryPath}`) - console.error( - 'Please ensure that the postinstall script has run successfully.', - ) process.exit(1) } diff --git a/package.json b/package.json index f0a1d6f..bb44587 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "build": "pnpm run /^build:/", "build:lib": "cargo build --release && node ./scripts/build.js", "build:preview": "vite build", - "postinstall": "node ./scripts/postinstall.js", "release": "pnpm release:check && pnpm release:version", "release:check": "pnpm test && pnpm run build", "release:version": "changelogen --output changelog.md --release --push", @@ -57,8 +56,7 @@ "files": [ "./bin", "./build", - "./dist", - "./scripts" + "./dist" ], "devDependencies": { "@azat-io/eslint-config-typescript": "^1.10.0", diff --git a/scripts/build.js b/scripts/build.js index 0092bdb..574df2a 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -31,7 +31,7 @@ if (!platformName || !archName) { let binaryName = platform === 'win32' ? 'todoctor.exe' : 'todoctor' let sourcePath = path.join(dirname, '..', 'target', 'release', binaryName) -let destDir = path.join(dirname, platformName, archName) +let destDir = path.join(dirname, '../bin/', platformName, archName) let destPath = path.join(destDir, binaryName) if (!fs.existsSync(destDir)) { @@ -40,10 +40,7 @@ if (!fs.existsSync(destDir)) { try { fs.copyFileSync(sourcePath, destPath) - - if (platform !== 'win32') { - fs.chmodSync(destPath, 0o755) - } + fs.chmodSync(destPath, 0o755) } catch (error) { console.error(`Error copying file: ${error.message}`) process.exit(1) diff --git a/scripts/postinstall.js b/scripts/postinstall.js deleted file mode 100644 index e068cfe..0000000 --- a/scripts/postinstall.js +++ /dev/null @@ -1,15 +0,0 @@ -import { fileURLToPath } from 'node:url' -import path from 'node:path' -import fs from 'node:fs' - -import { binaries } from '../bin/todoctor.js' - -let filename = fileURLToPath(import.meta.url) -let dirname = path.dirname(filename) - -Object.values(binaries).forEach(binaryPath => { - let fullBinaryPath = path.join(dirname, '../bin/', binaryPath) - if (fs.existsSync(fullBinaryPath)) { - fs.chmodSync(path.join(dirname, '../bin/', binaryPath), 0o755) - } -})