feat: browser session resume for pane promotion #844
Workflow file for this run
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: | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: [develop, main, beta] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| actions: read | |
| checks: write | |
| issues: write | |
| pull-requests: write | |
| security-events: write | |
| jobs: | |
| unit_tests: | |
| name: Unit Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| matrix: | |
| node-version: [20.x, 22.x, 24.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci --ignore-scripts | |
| - name: Verify lockfile integrity | |
| run: git diff --exit-code package-lock.json | |
| - name: Build | |
| run: npm run build | |
| - name: Type Check | |
| run: npx tsc --noEmit | |
| continue-on-error: true | |
| - name: Security Audit (npm) | |
| run: npm audit --audit-level=high | |
| continue-on-error: true | |
| - name: Security Scan (Trivy) | |
| uses: aquasecurity/trivy-action@master | |
| if: matrix.node-version == '20.x' | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| scanners: 'vuln,secret' | |
| severity: 'HIGH,CRITICAL' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| continue-on-error: true | |
| - name: Upload Trivy scan results | |
| uses: github/codeql-action/upload-sarif@v3 | |
| if: matrix.node-version == '20.x' && (success() || failure()) | |
| with: | |
| sarif_file: 'trivy-results.sarif' | |
| continue-on-error: true | |
| - name: Run Unit Tests | |
| run: | | |
| setsid npm test & | |
| TEST_PID=$! | |
| TEST_PGID=$(ps -o pgid= -p $TEST_PID | tr -d ' ') | |
| ( sleep 300 && kill -- -$TEST_PGID 2>/dev/null || true ) & | |
| KILLER_PID=$! | |
| wait $TEST_PID | |
| EXIT_CODE=$? | |
| kill $KILLER_PID 2>/dev/null || true | |
| exit $EXIT_CODE | |
| timeout-minutes: 6 | |
| publish: | |
| name: Publish | |
| needs: unit_tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci --ignore-scripts | |
| - name: Build | |
| run: npm run build | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| TAG_NAME=${{ github.ref_name }} | |
| VERSION=${TAG_NAME#v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| - name: Update package.json version | |
| run: npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version | |
| - name: Determine release type | |
| id: release-type | |
| run: | | |
| if [[ "${{ steps.version.outputs.version }}" == *"beta"* ]]; then | |
| echo "tag=beta" >> $GITHUB_OUTPUT | |
| echo "prerelease=true" >> $GITHUB_OUTPUT | |
| elif [[ "${{ steps.version.outputs.version }}" == *"alpha"* ]]; then | |
| echo "tag=alpha" >> $GITHUB_OUTPUT | |
| echo "prerelease=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag=latest" >> $GITHUB_OUTPUT | |
| echo "prerelease=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish to npm (Pre-release) | |
| if: steps.release-type.outputs.prerelease == 'true' | |
| run: npm publish --access public --ignore-scripts --tag ${{ steps.release-type.outputs.tag }} | |
| timeout-minutes: 5 | |
| - name: Publish to npm (Production) | |
| if: steps.release-type.outputs.prerelease == 'false' | |
| run: npm publish --access public --ignore-scripts | |
| timeout-minutes: 5 | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| draft: false | |
| prerelease: ${{ steps.release-type.outputs.prerelease }} | |
| body: | | |
| ## Changes | |
| See the [CHANGELOG](./CHANGELOG.md) for details. | |
| ## Installation | |
| ```bash | |
| npm install @ai-support-agent/cli@${{ steps.release-type.outputs.tag }} | |
| ``` | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Notify API of new version | |
| if: success() | |
| run: | | |
| if [ -z "$VERSION_API_URL" ] || [ -z "$VERSION_API_KEY" ]; then | |
| echo "::warning::AGENT_VERSION_API_URL or AGENT_VERSION_API_KEY is not set. Skipping version notification." | |
| exit 0 | |
| fi | |
| RESPONSE=$(curl -s -w "\n%{http_code}" -X PUT "$VERSION_API_URL/api/agent/version" \ | |
| -H "Content-Type: application/json" \ | |
| -H "X-API-Key: $VERSION_API_KEY" \ | |
| -d "{\"channel\":\"${{ steps.release-type.outputs.tag }}\",\"latestVersion\":\"${{ steps.version.outputs.version }}\"}") | |
| HTTP_CODE=$(echo "$RESPONSE" | tail -1) | |
| BODY=$(echo "$RESPONSE" | sed '$d') | |
| echo "Response: $BODY (HTTP $HTTP_CODE)" | |
| if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then | |
| echo "::error::Version notification failed with HTTP $HTTP_CODE" | |
| exit 1 | |
| fi | |
| env: | |
| VERSION_API_URL: ${{ secrets.AGENT_VERSION_API_URL }} | |
| VERSION_API_KEY: ${{ secrets.AGENT_VERSION_API_KEY }} |