Skip to content

Commit e4197a5

Browse files
committed
fix: set access rights when building package
1 parent 27b1ae7 commit e4197a5

File tree

5 files changed

+21
-26
lines changed

5 files changed

+21
-26
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,21 @@ jobs:
9090
if [[ "${{ matrix.arch }}" == "x64" ]]; then
9191
mkdir -p ./bin/linux/x64
9292
cp target/x86_64-unknown-linux-gnu/release/todoctor ./bin/linux/x64/todoctor
93+
chmod +x ./bin/linux/x64/todoctor
9394
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
9495
mkdir -p ./bin/linux/arm64
9596
cp target/aarch64-unknown-linux-gnu/release/todoctor ./bin/linux/arm64/todoctor
97+
chmod +x ./bin/linux/arm64/todoctor
9698
fi
9799
elif [[ "${{ matrix.platform }}" == "macos-latest" ]]; then
98100
if [[ "${{ matrix.arch }}" == "x64" ]]; then
99101
mkdir -p ./bin/macos/x64
100102
cp target/x86_64-apple-darwin/release/todoctor ./bin/macos/x64/todoctor
103+
chmod +x ./bin/macos/x64/todoctor
101104
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then
102105
mkdir -p ./bin/macos/arm64
103106
cp target/aarch64-apple-darwin/release/todoctor ./bin/macos/arm64/todoctor
107+
chmod +x ./bin/macos/arm64/todoctor
104108
fi
105109
fi
106110
shell: bash
@@ -168,6 +172,20 @@ jobs:
168172
name: todoctor-windows-latest-x64
169173
path: .
170174

175+
- name: Set Execute Permissions on Binaries
176+
run: |
177+
chmod +x ./bin/linux/x64/todoctor || true
178+
chmod +x ./bin/linux/arm64/todoctor || true
179+
chmod +x ./bin/macos/x64/todoctor || true
180+
chmod +x ./bin/macos/arm64/todoctor || true
181+
182+
- name: Verify Binary Permissions
183+
run: |
184+
ls -l ./bin/linux/x64/todoctor || true
185+
ls -l ./bin/linux/arm64/todoctor || true
186+
ls -l ./bin/macos/x64/todoctor || true
187+
ls -l ./bin/macos/arm64/todoctor || true
188+
171189
- name: Create GitHub Release
172190
run: pnpm run ci:changelog
173191
env:

bin/todoctor.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ let binaryPath = path.join(dirname, relativePath)
3232

3333
if (!fs.existsSync(binaryPath)) {
3434
console.error(`Binary not found: ${binaryPath}`)
35-
console.error(
36-
'Please ensure that the postinstall script has run successfully.',
37-
)
3835
process.exit(1)
3936
}
4037

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"build": "pnpm run /^build:/",
2626
"build:lib": "cargo build --release && node ./scripts/build.js",
2727
"build:preview": "vite build",
28-
"postinstall": "node ./scripts/postinstall.js",
2928
"release": "pnpm release:check && pnpm release:version",
3029
"release:check": "pnpm test && pnpm run build",
3130
"release:version": "changelogen --output changelog.md --release --push",
@@ -57,8 +56,7 @@
5756
"files": [
5857
"./bin",
5958
"./build",
60-
"./dist",
61-
"./scripts"
59+
"./dist"
6260
],
6361
"devDependencies": {
6462
"@azat-io/eslint-config-typescript": "^1.10.0",

scripts/build.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (!platformName || !archName) {
3131
let binaryName = platform === 'win32' ? 'todoctor.exe' : 'todoctor'
3232

3333
let sourcePath = path.join(dirname, '..', 'target', 'release', binaryName)
34-
let destDir = path.join(dirname, platformName, archName)
34+
let destDir = path.join(dirname, '../bin/', platformName, archName)
3535
let destPath = path.join(destDir, binaryName)
3636

3737
if (!fs.existsSync(destDir)) {
@@ -40,10 +40,7 @@ if (!fs.existsSync(destDir)) {
4040

4141
try {
4242
fs.copyFileSync(sourcePath, destPath)
43-
44-
if (platform !== 'win32') {
45-
fs.chmodSync(destPath, 0o755)
46-
}
43+
fs.chmodSync(destPath, 0o755)
4744
} catch (error) {
4845
console.error(`Error copying file: ${error.message}`)
4946
process.exit(1)

scripts/postinstall.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)