Skip to content

Commit

Permalink
Fix publish workflow for macOS
Browse files Browse the repository at this point in the history
Signed-off-by: paulober <[email protected]>
  • Loading branch information
paulober committed Sep 11, 2024
1 parent 617eacb commit 64a68ea
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
8 changes: 6 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ node_modules/**
src/**
.gitignore
.yarnrc
rollup.config.mjs
*rollup.config.mjs
**/tsconfig.json
**/eslint.config.mjs
**/*.map
vscodeUninstall.mjs
**/*.ts

.github/**
Expand All @@ -29,3 +29,7 @@ azure-pipelines.yml
!dist/*.cjs
!mpy_stubs/
!web/
!LICENSE.txt
!README.md
!CHANGELOG.md

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
}
},
"extensionDependencies": [
"ms-python.python"
],
"ms-python.python"
],
"activationEvents": [
"workspaceContains:.picowgo",
"workspaceContains:.micropico",
Expand Down
20 changes: 13 additions & 7 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ chmod +x "$SCRIPT_DIR/package.sh"

# 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 -r package_path; do
# Default target flags (for non-darwin platforms)
target_flags=""

# If the filename contains "darwin", add the appropriate target flags
# If the filename contains "darwin", skip as macOS universal publishing issn't possible at the moment
if [[ "$package_path" == *"darwin"* ]]; then
target_flags="--target darwin-x64 darwin-arm64 "
continue
fi

# Publish the VSCode extension to the VSCode Marketplace
npx @vscode/vsce publish $target_flags--packagePath "$package_path"
npx @vscode/vsce publish --packagePath "$package_path"
# Publish the VSCode extension to the Open VSX Registry
npx ovsx publish "$package_path" $target_flags-p "$OVSX_PAT"
npx ovsx publish "$package_path" -p "$OVSX_PAT"
# delete this vsix file
rm -rf "$package_path"
done

# macOS universal publish not possible workaround

rm *.vsix
rm -rf prebuilds
mkdir prebuilds
cp -r "node_modules/@serialport/bindings-cpp/prebuilds/darwin-x64+arm64" "./prebuilds"
npx @vscode/vsce publish --no-yarn --target darwin-x64 darwin-arm64
npx ovsx publish --target darwin-x64 darwin-arm64 -p "$OVSX_PAT"

0 comments on commit 64a68ea

Please sign in to comment.