Merge pull request #8 from aaron-seq/fix/eslint-unused-variables #22
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/CD Pipeline | ||
| on: | ||
| push: | ||
| branches: [ main, feature/* ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| node-version: [18.x, 20.x] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use 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 | ||
| - name: Run tests | ||
| run: npm run test:coverage | ||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| fail_ci_if_error: false | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| needs: test | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use Node.js 18.x | ||
| 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:extension | ||
| - name: Build web demo | ||
| run: npm run build:web | ||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: build-files | ||
| path: | | ||
| dist/ | ||
| web/ | ||
| manifest.json | ||
| e2e-test: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Use Node.js 18.x | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 18.x | ||
| cache: 'npm' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Install Playwright browsers | ||
| run: npx playwright install | ||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| name: build-files | ||
| - name: Run E2E tests | ||
| run: npm run test:e2e | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| needs: [test, build, e2e-test] | ||
| if: github.ref == 'refs/heads/main' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Deploy to Vercel | ||
| uses: amondnet/vercel-action@v25 | ||
| with: | ||
| vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | ||
| vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | ||
| vercel-args: '--prod' | ||
| working-directory: ./ | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| needs: [test, build, e2e-test] | ||
| if: github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'release:') | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Use Node.js 18.x | ||
| 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:extension | ||
| - name: Create extension package | ||
| run: | | ||
| mkdir -p release | ||
| cp -r dist/* release/ | ||
| cp manifest.json release/ | ||
| cp -r assets release/ || true | ||
| cd release | ||
| zip -r ../genai-browser-tool-extension.zip * | ||
| - name: Extract version from commit message | ||
| id: version | ||
| run: echo "version=$(echo '${{ github.event.head_commit.message }}' | grep -oP 'release: v\K[0-9]+\.[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT | ||
| - name: Create Release | ||
| uses: actions/create-release@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag_name: v${{ steps.version.outputs.version }} | ||
| release_name: GenAI Browser Tool v${{ steps.version.outputs.version }} | ||
| body: | | ||
| ## What's New | ||
| - Modern architecture with improved performance | ||
| - Enhanced AI provider support | ||
| - Better error handling and validation | ||
| - Improved user interface | ||
| ## Installation | ||
| 1. Download the extension zip file | ||
| 2. Extract to a folder | ||
| 3. Open Chrome extensions (chrome://extensions) | ||
| 4. Enable Developer Mode | ||
| 5. Click "Load unpacked" and select the extracted folder | ||
| 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: ./genai-browser-tool-extension.zip | ||
| asset_name: genai-browser-tool-extension.zip | ||
| asset_content_type: application/zip | ||