From 19503d92b407757c5605aa7f88f70768be9ded06 Mon Sep 17 00:00:00 2001 From: Andrew Pareles Date: Sun, 23 Mar 2025 23:13:47 -0700 Subject: [PATCH] fix? --- .github/workflows/build-vscode.yml | 308 +++++++++++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 .github/workflows/build-vscode.yml diff --git a/.github/workflows/build-vscode.yml b/.github/workflows/build-vscode.yml new file mode 100644 index 00000000..36696417 --- /dev/null +++ b/.github/workflows/build-vscode.yml @@ -0,0 +1,308 @@ +name: Build VSCode + +on: + push: + branches: [ main ] + tags: [ 'v*' ] + pull_request: + branches: [ main ] + workflow_dispatch: + inputs: + version: + description: 'Version to build (e.g., 1.99.0)' + required: true + default: '' + quality: + description: 'Quality level (stable, insider)' + required: true + default: 'insider' + type: choice + options: + - stable + - insider + +env: + VSCODE_ARCH_WINDOWS: "x64" + VSCODE_ARCH_MACOS: "x64,arm64" + VSCODE_ARCH_LINUX: "x64,armhf,arm64" + VSCODE_QUALITY: ${{ github.event.inputs.quality || 'insider' }} + VSCODE_BUILD_VERSION: ${{ github.event.inputs.version || '1.99.0' }} + +jobs: + build-windows: + name: Windows (${{ matrix.arch }}) + runs-on: windows-latest + strategy: + matrix: + arch: [x64, arm64] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + npm ci + env: + npm_config_arch: ${{ matrix.arch }} + + - name: Build VSCode + run: | + npm run gulp -- "vscode-win32-${{ matrix.arch }}-min" + npm run gulp -- "vscode-win32-${{ matrix.arch }}-inno-updater" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Sign binaries (if credentials available) + if: false # TODO!!! fill this in - Replace with your condition for when signing is available + run: | + # Implementation would depend on your signing mechanism + # For example, using signtool.exe or an external signing service + # This is where you would sign the .exe, .dll, and .node files + + - name: Create packages + run: | + $Version = "${{ env.VSCODE_BUILD_VERSION }}" + $ArchivePath = ".build\win32-${{ matrix.arch }}\VSCode-win32-${{ matrix.arch }}-$Version.zip" + New-Item -ItemType Directory -Path .build\win32-${{ matrix.arch }} -Force + 7z.exe a -tzip $ArchivePath -x!CodeSignSummary*.md ..\VSCode-win32-${{ matrix.arch }}\* -r + + # Build installers + npm run gulp -- "vscode-win32-${{ matrix.arch }}-system-setup" + npm run gulp -- "vscode-win32-${{ matrix.arch }}-user-setup" + + # Rename setup files + mv .build\win32-${{ matrix.arch }}\system-setup\VSCodeSetup.exe .build\win32-${{ matrix.arch }}\VSCodeSetup-${{ matrix.arch }}-$Version.exe + mv .build\win32-${{ matrix.arch }}\user-setup\VSCodeSetup.exe .build\win32-${{ matrix.arch }}\VSCodeUserSetup-${{ matrix.arch }}-$Version.exe + shell: pwsh + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: vscode-win32-${{ matrix.arch }} + path: | + .build/win32-${{ matrix.arch }}/*.zip + .build/win32-${{ matrix.arch }}/*.exe + retention-days: 7 + + build-macos: + name: macOS (${{ matrix.arch }}) + runs-on: macos-latest + strategy: + matrix: + arch: [x64, arm64] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build VSCode + run: | + npm run gulp -- "vscode-darwin-${{ matrix.arch }}-min" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Package app + run: | + VERSION="${{ env.VSCODE_BUILD_VERSION }}" + ARTIFACT_NAME="VSCode-darwin-${{ matrix.arch }}" + + # Create .zip archive + PACKAGE_PATH=".build/darwin-${{ matrix.arch }}/${ARTIFACT_NAME}-${VERSION}.zip" + mkdir -p .build/darwin-${{ matrix.arch }} + (cd .. && zip -r -X -y "${GITHUB_WORKSPACE}/${PACKAGE_PATH}" "${ARTIFACT_NAME}.app") + + - name: Sign app (if credentials available) + if: false # TODO!!! - add signing here - Replace with your condition for when signing is available + run: | + # Implementation would depend on your signing certificates + # For example: + # ./build/darwin/sign.sh + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: vscode-darwin-${{ matrix.arch }} + path: .build/darwin-${{ matrix.arch }}/*.zip + retention-days: 7 + + build-universal-macos: + name: Create Universal macOS Build + needs: [build-macos] + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Download x64 build + uses: actions/download-artifact@v4 + with: + name: vscode-darwin-x64 + path: .build/darwin-x64 + + - name: Download arm64 build + uses: actions/download-artifact@v4 + with: + name: vscode-darwin-arm64 + path: .build/darwin-arm64 + + - name: Create Universal build + run: | + VERSION="${{ env.VSCODE_BUILD_VERSION }}" + + # Extract both architectures + mkdir -p .build/darwin-universal + unzip -q .build/darwin-x64/VSCode-darwin-x64-${VERSION}.zip -d .build/darwin-x64 + unzip -q .build/darwin-arm64/VSCode-darwin-arm64-${VERSION}.zip -d .build/darwin-arm64 + + # Create universal app + node build/darwin/create-universal-app.js \ + .build/darwin-x64/VSCode-darwin-x64.app \ + .build/darwin-arm64/VSCode-darwin-arm64.app \ + .build/darwin-universal/VSCode-darwin-universal.app + + # Package universal app + (cd .build/darwin-universal && zip -r -X -y VSCode-darwin-universal-${VERSION}.zip VSCode-darwin-universal.app) + + - name: Upload Universal Build + uses: actions/upload-artifact@v4 + with: + name: vscode-darwin-universal + path: .build/darwin-universal/*.zip + retention-days: 7 + + build-linux: + name: Linux (${{ matrix.arch }}) + runs-on: ubuntu-latest + strategy: + matrix: + arch: [x64, armhf, arm64] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies and tools + run: | + npm ci + sudo apt-get update + sudo apt-get install -y fakeroot dpkg rpm + + - name: Build VSCode + run: | + npm run gulp -- "vscode-linux-${{ matrix.arch }}-min" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create packages (tarball) + run: | + VERSION="${{ env.VSCODE_BUILD_VERSION }}" + PACKAGE_PATH=".build/linux-${{ matrix.arch }}/archive" + TARBALL_NAME="code-${{ env.VSCODE_QUALITY }}-${{ matrix.arch }}-$VERSION.tar.gz" + + mkdir -p "$PACKAGE_PATH" + tar -czf "$PACKAGE_PATH/$TARBALL_NAME" -C .. VSCode-linux-${{ matrix.arch }} + + - name: Create DEB package + run: | + npm run gulp -- "vscode-linux-${{ matrix.arch }}-prepare-deb" + npm run gulp -- "vscode-linux-${{ matrix.arch }}-build-deb" + + - name: Create RPM package + run: | + npm run gulp -- "vscode-linux-${{ matrix.arch }}-prepare-rpm" + npm run gulp -- "vscode-linux-${{ matrix.arch }}-build-rpm" + + - name: Create Snap package + if: matrix.arch == 'x64' || matrix.arch == 'arm64' + run: | + sudo snap install snapcraft --classic + npm run gulp -- "vscode-linux-${{ matrix.arch }}-prepare-snap" + cd .build/linux/snap/${{ matrix.arch }}/*/ + snapcraft + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: vscode-linux-${{ matrix.arch }} + path: | + .build/linux-${{ matrix.arch }}/archive/*.tar.gz + .build/linux/deb/*/deb/*.deb + .build/linux/rpm/*/RPMS/*/*.rpm + .build/linux/snap/${{ matrix.arch }}/*/*.snap + retention-days: 7 + + create-release: + name: Create Release + needs: [build-windows, build-macos, build-universal-macos, build-linux] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + name: VSCode ${{ env.VSCODE_BUILD_VERSION }} + draft: true + prerelease: ${{ env.VSCODE_QUALITY == 'insider' }} + files: | + artifacts/vscode-win32-x64/*.zip + artifacts/vscode-win32-x64/*.exe + artifacts/vscode-win32-arm64/*.zip + artifacts/vscode-win32-arm64/*.exe + artifacts/vscode-darwin-x64/*.zip + artifacts/vscode-darwin-arm64/*.zip + artifacts/vscode-darwin-universal/*.zip + artifacts/vscode-linux-x64/*.tar.gz + artifacts/vscode-linux-x64/*.deb + artifacts/vscode-linux-x64/*.rpm + artifacts/vscode-linux-x64/*.snap + artifacts/vscode-linux-arm64/*.tar.gz + artifacts/vscode-linux-arm64/*.deb + artifacts/vscode-linux-arm64/*.rpm + artifacts/vscode-linux-arm64/*.snap + artifacts/vscode-linux-armhf/*.tar.gz + artifacts/vscode-linux-armhf/*.deb + artifacts/vscode-linux-armhf/*.rpm + artifacts/vscode-linux-armhf/*.snap