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: Build and Release VS Code Extension | |
| on: | |
| push: | |
| branches: [ main, develop, feature/* ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [16.x, 18.x, 20.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linter | |
| run: npm run lint || true | |
| - name: Run tests | |
| run: npm test || true | |
| - name: Build extension | |
| run: npm run build | |
| - name: Package extension | |
| run: | | |
| npm install -g vsce | |
| vsce package --out sigscan-${{ github.sha }}.vsix | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: extension-${{ matrix.node-version }}-${{ github.sha }} | |
| path: "*.vsix" | |
| retention-days: 30 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build extension | |
| run: npm run build | |
| - name: Package extension for release | |
| run: | | |
| npm install -g vsce | |
| vsce package | |
| - name: Get version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: SigScan v${{ steps.get_version.outputs.VERSION }} | |
| body: | | |
| ## 🚀 SigScan v${{ steps.get_version.outputs.VERSION }} | |
| ### Features | |
| - Enhanced signature organization with separate files for contracts, libraries, and tests | |
| - Automatic deduplication of signatures to avoid repetition | |
| - File watching with incremental updates | |
| - Automatic .gitignore updates for signatures folder | |
| - Improved library contract filtering (only inherited contracts) | |
| ### Installation | |
| Download the `.vsix` file below and install it via: | |
| ``` | |
| code --install-extension sigscan-${{ steps.get_version.outputs.VERSION }}.vsix | |
| ``` | |
| Or use the VS Code Extensions panel: `Extensions > Views and More Actions... > Install from VSIX...` | |
| ### What's Changed | |
| - Signatures are now organized in separate files: `signatures-contracts.txt`, `signatures-libs.txt`, `signatures-tests.txt` | |
| - Duplicate signatures (like vm.prank, assertTrue in tests) are automatically removed | |
| - Only inherited library contracts are included in signatures-libs.txt | |
| - Existing signature files are updated instead of creating new timestamped files | |
| - Automatic file watching for real-time updates | |
| draft: false | |
| prerelease: false | |
| - name: Upload Release Asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./sigscan-${{ steps.get_version.outputs.VERSION }}.vsix | |
| asset_name: sigscan-${{ steps.get_version.outputs.VERSION }}.vsix | |
| asset_content_type: application/zip | |
| - name: Copy to releases directory | |
| run: | | |
| mkdir -p releases | |
| cp sigscan-${{ steps.get_version.outputs.VERSION }}.vsix releases/ | |
| - name: Commit and push to releases | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add releases/ | |
| git commit -m "Add release v${{ steps.get_version.outputs.VERSION }}" || exit 0 | |
| git push origin main || exit 0 | |
| publish-marketplace: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build extension | |
| run: npm run build | |
| - name: Publish to VS Code Marketplace | |
| env: | |
| VSCE_PAT: ${{ secrets.VSCE_PAT }} | |
| run: | | |
| if [ -n "$VSCE_PAT" ]; then | |
| npm install -g vsce | |
| vsce publish -p $VSCE_PAT | |
| echo "Published to VS Code Marketplace" | |
| else | |
| echo "VSCE_PAT not set, skipping marketplace publication" | |
| fi |