Skip to content

fix: mark React output imports as external at tsup level to prevent b… #15

fix: mark React output imports as external at tsup level to prevent b…

fix: mark React output imports as external at tsup level to prevent b… #15

name: Post-Merge Packaging
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false # Don't cancel, let it complete
permissions:
contents: write
env:
VSCODE_QUALITY: 'oss'
jobs:
package-matrix:
name: Package (${{ matrix.os }}-${{ matrix.arch }})
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- os: win32
arch: x64
runs-on: windows-latest
- os: darwin
arch: arm64
runs-on: macos-14
- os: linux
arch: x64
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Prepare node_modules cache key
shell: bash
run: |
mkdir -p .build
if [ -f "build/azure-pipelines/common/computeNodeModulesCacheKey.js" ]; then
node build/azure-pipelines/common/computeNodeModulesCacheKey.js ${{ matrix.os }} ${{ matrix.arch }} $(node -p process.arch) > .build/packagelockhash
else
echo "${{ hashFiles('package-lock.json') }}" > .build/packagelockhash
fi
- name: Restore node_modules cache
id: cache-node-modules
uses: actions/cache/restore@v4
with:
path: .build/node_modules_cache
key: "node_modules-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('.build/packagelockhash') }}"
restore-keys: |
node_modules-${{ matrix.os }}-${{ matrix.arch }}-
- name: Extract node_modules cache
if: steps.cache-node-modules.outputs.cache-hit == 'true'
shell: bash
run: |
if [ "${{ matrix.os }}" = "win32" ]; then
# Try 7z first, fallback to PowerShell Expand-Archive if 7z not available
if command -v 7z.exe &> /dev/null; then
7z.exe x .build/node_modules_cache/cache.7z -aoa || true
elif command -v powershell.exe &> /dev/null; then
powershell.exe -Command "Expand-Archive -Path .build/node_modules_cache/cache.7z -DestinationPath . -Force" || true
else
echo "Warning: No extraction tool found for Windows. Skipping cache extraction."
fi
else
tar -xzf .build/node_modules_cache/cache.tgz || true
fi
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
shell: bash
run: npm ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create node_modules archive
if: steps.cache-node-modules.outputs.cache-hit != 'true'
shell: bash
run: |
if [ "${{ matrix.os }}" = "win32" ]; then
if [ -f "build/azure-pipelines/common/listNodeModules.js" ]; then
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
mkdir -p .build/node_modules_cache
# Try 7z first, fallback to PowerShell Compress-Archive if 7z not available
if command -v 7z.exe &> /dev/null; then
7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt
elif command -v powershell.exe &> /dev/null; then
# PowerShell fallback - note: this creates a zip, not 7z
powershell.exe -Command "Compress-Archive -Path (Get-Content .build/node_modules_list.txt) -DestinationPath .build/node_modules_cache/cache.zip -Force" || echo "Warning: Failed to create archive"
else
echo "Warning: No compression tool found for Windows. Skipping cache creation."
fi
fi
else
if [ -f "build/azure-pipelines/common/listNodeModules.js" ]; then
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
mkdir -p .build/node_modules_cache
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
fi
fi
- name: Compile application
shell: bash
run: |
echo "Compiling application for ${{ matrix.os }}-${{ matrix.arch }}"
npm run compile
env:
VSCODE_ARCH: ${{ matrix.arch }}
npm_config_arch: ${{ matrix.arch }}
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
- name: Build package
shell: bash
run: |
echo "Building package for ${{ matrix.os }}-${{ matrix.arch }}"
# TODO: Implement actual packaging commands based on your build system
# Common options:
# - npm run gulp package-${{ matrix.os }}-${{ matrix.arch }}
# - npm run electron-builder -- --${{ matrix.os }} --${{ matrix.arch }}
# For now, this step compiles but doesn't create distributable packages
# See build/gulpfile.vscode.js for packaging task examples
echo "⚠️ Package build step is a placeholder - actual packaging not yet implemented"
echo "📝 To implement: Add packaging commands based on build/gulpfile.vscode.js packageTask()"
env:
VSCODE_ARCH: ${{ matrix.arch }}
npm_config_arch: ${{ matrix.arch }}
- name: Generate checksums
shell: bash
run: |
# Generate SHA256 checksums for all artifacts
find .build -name "*.zip" -o -name "*.dmg" -o -name "*.exe" -o -name "*.AppImage" | while read file; do
if [ "${{ matrix.os }}" = "win32" ]; then
certutil -hashfile "$file" SHA256 > "$file.sha256" || echo "Checksum generation failed for $file"
else
shasum -a 256 "$file" > "$file.sha256" || sha256sum "$file" > "$file.sha256"
fi
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: package-${{ matrix.os }}-${{ matrix.arch }}-${{ github.sha }}
path: |
.build/**/*.zip
.build/**/*.dmg
.build/**/*.exe
.build/**/*.AppImage
.build/**/*.sha256
retention-days: 30
if-no-files-found: ignore
- name: Save node_modules cache
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: .build/node_modules_cache
key: "node_modules-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('.build/packagelockhash') }}"