Skip to content

Commit

Permalink
update build process
Browse files Browse the repository at this point in the history
  • Loading branch information
jigsawye committed Nov 10, 2024
1 parent b4e4a8b commit 14f196d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,17 @@ jobs:
- name: Prepare package
shell: bash
run: |
mkdir -p npm/@swagit/${{ matrix.name }}/bin
if [ "${{ matrix.name }}" = "win32-x64" ]; then
cp target/${{ matrix.target }}/release/swagit.exe npm/@swagit/${{ matrix.name }}/bin/
cp build/target/${{ matrix.target }}/release/swagit.exe packages/${{ matrix.name }}/bin
else
cp target/${{ matrix.target }}/release/swagit npm/@swagit/${{ matrix.name }}/bin/
cp build/target/${{ matrix.target }}/release/swagit packages/${{ matrix.name }}/bin
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: npm/@swagit/${{ matrix.name }}
path: packages/${{ matrix.name }}/bin
compression-level: 0

release:
Expand Down
2 changes: 1 addition & 1 deletion packages/darwin-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"arm64"
],
"files": [
"sg"
"bin"
],
"description": "macOS ARM64 binary for swagit"
}
2 changes: 1 addition & 1 deletion packages/darwin-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"x64"
],
"files": [
"sg"
"bin"
],
"description": "macOS x64 binary for swagit"
}
2 changes: 1 addition & 1 deletion packages/linux-arm64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"arm64"
],
"files": [
"sg"
"bin"
],
"description": "Linux ARM64 binary for swagit"
}
2 changes: 1 addition & 1 deletion packages/linux-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"x64"
],
"files": [
"sg"
"bin"
],
"description": "Linux x64 binary for swagit"
}
4 changes: 3 additions & 1 deletion packages/swagit/bin/swagit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ function getBinaryPath() {
throw new Error(`Unsupported platform: ${platform_arch}`);
}

return require.resolve(binary_path);
const sub_path = platform === 'win32' ? 'swagit.exe' : 'swagit';

return require.resolve(`${binary_path}/bin/${sub_path}`);
}

require('child_process')
Expand Down
2 changes: 1 addition & 1 deletion packages/win32-x64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"x64"
],
"files": [
"sg.exe"
"bin"
],
"description": "Windows x64 binary for swagit"
}

0 comments on commit 14f196d

Please sign in to comment.