-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: paulober <[email protected]>
- Loading branch information
Showing
4 changed files
with
50 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# This script's purpose is to publish the VSCode extension to the VSCode Marketplace | ||
# and package binaries for each platform to reduced vsix size | ||
|
||
# Run npm run package (not needed as prepublish script already runs it) | ||
#npm run package | ||
|
||
# Create a folder dist/scripts if it doesn't exist | ||
mkdir -p dist/scripts | ||
# and OpenVSX Registry also it packages binaries for each | ||
# platform to reduced vsix size | ||
|
||
# Define an array of platforms | ||
platforms=("win32" "macOS_arm64" "macOS_amd64" "linux_arm64" "linux_armhf" "linux_amd64") | ||
platforms=("win32-x64" "darwin-x64+arm64" "linux-arm64" "linux-arm" "linux-x64" "universal") | ||
rm -rf dist | ||
|
||
# Loop through the platforms | ||
for platform in "${platforms[@]}"; do | ||
# Copy the scripts to dist/scripts for each platform | ||
cp -r "node_modules/@paulober/pyboard-serial-com/scripts/wrapper_$platform" "dist/scripts" | ||
rm -rf prebuilds | ||
mkdir prebuilds | ||
|
||
if [ "$platform" != "universal" ]; then | ||
# Copy the bindings binary for each platform | ||
cp -r "node_modules/@serialport/bindings-cpp/prebuilds/$platform" "./prebuilds" | ||
else | ||
# Copy the bindings binaries for all platforms | ||
cp -r "node_modules/@serialport/bindings-cpp/prebuilds" "./" | ||
fi | ||
|
||
# Package the VSCode extension for the platform | ||
if [ "$platform" == "win32" ]; then | ||
npx @vscode/vsce package --no-yarn --target "win32-x64" | ||
elif [ "$platform" == "macOS_arm64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "darwin-arm64" | ||
elif [ "$platform" == "macOS_amd64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "darwin-x64" | ||
elif [ "$platform" == "linux_arm64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "linux-arm64" | ||
elif [ "$platform" == "linux_armhf" ]; then | ||
npx @vscode/vsce package --no-yarn --target "linux-armhf" | ||
elif [ "$platform" == "linux_amd64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "linux-x64" | ||
if [ "$platform" == "win32-x64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "win32-x64" -o "micropico-$RELEASE_TAG_NAME-$platform.vsix" | ||
elif [ "$platform" == "darwin-x64+arm64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "darwin-arm64 darwin-x64" -o "micropico-$RELEASE_TAG_NAME-$platform.vsix" | ||
elif [ "$platform" == "linux-arm64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "linux-arm64" -o "micropico-$RELEASE_TAG_NAME-$platform.vsix" | ||
elif [ "$platform" == "linux-arm" ]; then | ||
npx @vscode/vsce package --no-yarn --target "linux-armhf" -o "micropico-$RELEASE_TAG_NAME-linux-armhf.vsix" | ||
elif [ "$platform" == "linux-x64" ]; then | ||
npx @vscode/vsce package --no-yarn --target "linux-x64" -o "micropico-$RELEASE_TAG_NAME-$platform.vsix" | ||
else | ||
npx @vscode/vsce package --no-yarn -o "micropico-$RELEASE_TAG_NAME.vsix" | ||
fi | ||
|
||
# Remove the copied scripts for the current platform | ||
rm -r "dist/scripts/wrapper_$platform" | ||
done | ||
|
||
# Find all .vsix files and publish them one by one | ||
find . -name "*.vsix" -type f | while read -r package_path; do | ||
# Find all .vsix files except the one without a platform prefix and publish them one by one | ||
find . -type f -name "micropico-$RELEASE_TAG_NAME-*.vsix" ! -name "micropico-$RELEASE_TAG_NAME.vsix" | while read file -r package_path; do | ||
# Publish the VSCode extension to the VSCode Marketplace | ||
npx @vscode/vsce publish --packagePath "$package_path" | ||
# Publish the VSCode extension to the Open VSX Registry | ||
#npx ovsx publish "$package_path" -p "$OVSX_PAT" | ||
npx ovsx publish "$package_path" -p "$OVSX_PAT" | ||
# delete this vsix file | ||
rm -rf "$package_path" | ||
done |