feat(frontend): show message if internal error / open ai error or api… #39
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 | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'zendesk_app/manifest.json' | |
| - 'zendesk_app/src/manifest.json' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: zendesk_app | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| - name: Use Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| cache-dependency-path: zendesk_app/package-lock.json | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| VERSION=$(node -p "require('./src/manifest.json').version") | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create and push tag | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| run: | | |
| git config user.email "stan@quivr.app" | |
| git config user.name "StanGirard" | |
| git tag -a "v${{ steps.get_version.outputs.version }}" -m "Version ${{ steps.get_version.outputs.version }}" | |
| git push origin "v${{ steps.get_version.outputs.version }}" | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Install ZCLI | |
| run: npm i @zendesk/zcli -g | |
| # Build Preview Version | |
| - name: Build Preview Version | |
| env: | |
| ZENDESK_SUBDOMAIN: ${{ secrets.ZENDESK_PREVIEW_SUBDOMAIN }} | |
| ZENDESK_EMAIL: ${{ secrets.ZENDESK_PREVIEW_EMAIL }} | |
| ZENDESK_API_TOKEN: ${{ secrets.ZENDESK_PREVIEW_API_TOKEN }} | |
| run: | | |
| # Replace API URLs with preview URL | |
| sed -i 's|https://api.quivr.app|https://api-preview.quivr.app|g' src/app/services/quivr.ts | |
| sed -i 's|https://api.quivr.app|https://api-preview.quivr.app|g' src/app/contexts/QuivrApiProvider.tsx | |
| sed -i 's|http://localhost:3000/modal|assets/modal.html|g' src/app/components/RightPanelApp/components/ResponseContainer/ResponseContainer.tsx | |
| npm run build | |
| zcli apps:package dist | |
| ZIP_FILE=$(find . -name "app-*.zip" -type f) | |
| if [ $(echo "$ZIP_FILE" | wc -l) -ne 1 ]; then | |
| echo "Error: Found multiple or no zip files" | |
| exit 1 | |
| fi | |
| mv "$ZIP_FILE" preview.zip | |
| # Build Production Version | |
| - name: Build Production Version | |
| env: | |
| ZENDESK_SUBDOMAIN: ${{ secrets.ZENDESK_PROD_SUBDOMAIN }} | |
| ZENDESK_EMAIL: ${{ secrets.ZENDESK_PROD_EMAIL }} | |
| ZENDESK_API_TOKEN: ${{ secrets.ZENDESK_PROD_API_TOKEN }} | |
| run: | | |
| # Restore original API URLs | |
| sed -i 's|https://api-preview.quivr.app|https://api.quivr.app|g' src/app/services/quivr.ts | |
| sed -i 's|https://api-preview.quivr.app|https://api.quivr.app|g' src/app/contexts/QuivrApiProvider.tsx | |
| rm -rf dist | |
| npm run build | |
| zcli apps:package dist | |
| ZIP_FILE=$(find . -name "app-*.zip" -type f) | |
| if [ $(echo "$ZIP_FILE" | wc -l) -ne 1 ]; then | |
| echo "Error: Found multiple or no zip files" | |
| exit 1 | |
| fi | |
| mv "$ZIP_FILE" production.zip | |
| # Create GitHub Release | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| release_name: Release v${{ steps.get_version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| # Upload Preview ZIP | |
| - name: Upload Preview ZIP | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./zendesk_app/preview.zip | |
| asset_name: preview.zip | |
| asset_content_type: application/zip | |
| # Upload Production ZIP | |
| - name: Upload Production ZIP | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./zendesk_app/production.zip | |
| asset_name: production.zip | |
| asset_content_type: application/zip |