diff --git a/.github/workflows/nightly-extensions.yml b/.github/workflows/nightly-extensions.yml index 3d9af6bd2..911c3f665 100644 --- a/.github/workflows/nightly-extensions.yml +++ b/.github/workflows/nightly-extensions.yml @@ -469,6 +469,62 @@ jobs: run: | npx tsx .github/scripts/index.ts ext-github-releases + publish-to-cbweb-marketplace: + name: Publish to CBWeb Internal Marketplace + needs: [package, create-github-releases, calculate-artifact-name] + runs-on: ubuntu-latest + continue-on-error: true + if: needs.package.result == 'success' + steps: + - name: Download VSIX artifacts + uses: actions/download-artifact@v8 + with: + name: ${{ needs.calculate-artifact-name.outputs.artifact-name }} + path: ./vsix-artifacts + + - name: Find web VSIX + id: find-web-vsix + run: | + VSIX_FILE=$(find ./vsix-artifacts -name "*-web-*.vsix" | head -1) + if [ -z "$VSIX_FILE" ]; then + echo "::error::No web VSIX file found in artifacts" + exit 1 + fi + + FILE_SIZE=$(stat -c%s "$VSIX_FILE" 2>/dev/null || stat -f%z "$VSIX_FILE" 2>/dev/null || echo "unknown") + echo "Found web VSIX: $VSIX_FILE (${FILE_SIZE} bytes)" + echo "vsix_file=$VSIX_FILE" >> $GITHUB_OUTPUT + + - name: Publish web VSIX to CBWeb marketplace + if: inputs.dry-run != 'true' && github.event.inputs.dry-run != 'true' + run: | + echo "Publishing $VSIX_FILE to CBWeb marketplace..." + + HTTP_CODE=$(curl -s -o response.json -w '%{http_code}' \ + --retry 2 --retry-delay 5 \ + -X POST "${MARKETPLACE_URL}/api/internal/publish" \ + -H "Authorization: Bearer ${MARKETPLACE_DEPLOY_TOKEN}" \ + -F "vsix=@${VSIX_FILE}") + + echo "HTTP response code: $HTTP_CODE" + cat response.json + + if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + echo "Successfully published to CBWeb marketplace" + else + echo "::warning::Failed to publish to CBWeb marketplace (HTTP $HTTP_CODE)" + exit 1 + fi + env: + VSIX_FILE: ${{ steps.find-web-vsix.outputs.vsix_file }} + MARKETPLACE_URL: ${{ vars.MARKETPLACE_URL }} + MARKETPLACE_DEPLOY_TOKEN: ${{ secrets.MARKETPLACE_DEPLOY_TOKEN }} + + - name: Dry-run summary + if: inputs.dry-run == 'true' || github.event.inputs.dry-run == 'true' + run: | + echo "🔄 DRY RUN: Would publish ${{ steps.find-web-vsix.outputs.vsix_file }} to CBWeb marketplace" + slack-notify: name: Slack Notification needs: diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 4be96e47b..5707954dd 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -88,13 +88,35 @@ jobs: npm run package:packages fi + - name: Package web-only VSIX + working-directory: packages/apex-lsp-vscode-extension + run: | + if [ "${{ inputs.pre-release }}" = "true" ]; then + npx vsce package --target web --no-dependencies --pre-release + else + npx vsce package --target web --no-dependencies + fi + + WEB_VSIX=$(find . -maxdepth 1 -name "*-web-*.vsix" | head -1) + if [ -n "$WEB_VSIX" ]; then + BEFORE_SIZE=$(stat -c%s "$WEB_VSIX" 2>/dev/null || stat -f%z "$WEB_VSIX" 2>/dev/null) + zip -d "$WEB_VSIX" \ + "extension/dist/extension.js" \ + "extension/dist/server.node.js" \ + "extension/dist/*.map" \ + "extension/dist/webview/*.map" \ + 2>/dev/null || true + AFTER_SIZE=$(stat -c%s "$WEB_VSIX" 2>/dev/null || stat -f%z "$WEB_VSIX" 2>/dev/null) + echo "Optimized web VSIX: ${BEFORE_SIZE} -> ${AFTER_SIZE} bytes" + fi + - name: Generate MD5 checksums id: md5-checksums run: | echo "Generating MD5 checksums for VSIX files..." - # Find all VSIX files and generate MD5 checksums - VSIX_FILES=$(find packages -name "*.vsix" -type f) + # Find non-web VSIX files and generate MD5 checksums + VSIX_FILES=$(find packages -name "*.vsix" -type f ! -name "*-web-*") if [ -z "$VSIX_FILES" ]; then echo "No VSIX files found to generate checksums for"