fix(ci): pass --allow-package-secrets github to vsce publish #14
This file contains hidden or 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
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - '.vscode/**' | |
| - 'media/example/**' | |
| pull_request: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - '.vscode/**' | |
| - 'media/example/**' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Compile extension | |
| run: npm run compile | |
| - name: Package extension | |
| run: npm run package | |
| - name: Upload VSIX artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: vscode-github-desktop-vsix | |
| path: '*.vsix' | |
| validate: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download VSIX artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: vscode-github-desktop-vsix | |
| - name: Validate extension manifest | |
| run: | | |
| echo "Validating package.json..." | |
| node -e " | |
| const pkg = require('./package.json'); | |
| // Check required fields | |
| const required = ['name', 'displayName', 'description', 'version', 'engines', 'publisher']; | |
| for (const field of required) { | |
| if (!pkg[field]) { | |
| console.error(\`Missing required field: \${field}\`); | |
| process.exit(1); | |
| } | |
| } | |
| // Validate version format | |
| if (!/^\d+\.\d+\.\d+$/.test(pkg.version)) { | |
| console.error('Invalid version format. Use semantic versioning (x.y.z)'); | |
| process.exit(1); | |
| } | |
| // Check VS Code engine compatibility | |
| if (!pkg.engines.vscode || !pkg.engines.vscode.includes('1.84.0')) { | |
| console.error('VS Code engine version should be >= 1.84.0'); | |
| process.exit(1); | |
| } | |
| console.log('✓ Extension manifest is valid'); | |
| console.log(\` Name: \${pkg.name}\`); | |
| console.log(\` Version: \${pkg.version}\`); | |
| console.log(\` Publisher: \${pkg.publisher}\`); | |
| " | |
| - name: Check VSIX size | |
| run: | | |
| VSIX_FILE=$(ls *.vsix | head -1) | |
| SIZE=$(stat -c%s "$VSIX_FILE" 2>/dev/null || stat -f%z "$VSIX_FILE" 2>/dev/null) | |
| SIZE_MB=$((SIZE / 1048576)) | |
| echo "VSIX file size: ${SIZE_MB}MB" | |
| if [ $SIZE_MB -gt 100 ]; then | |
| echo "Warning: VSIX file is larger than 100MB. Consider optimizing bundle size." | |
| fi |