Build and Release #4
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: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 0.0.1)' | |
| required: true | |
| default: '0.0.1' | |
| jobs: | |
| test: | |
| name: Run Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run all unit tests | |
| run: npm run test:run | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: coverage/ | |
| retention-days: 5 | |
| if-no-files-found: ignore | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| needs: test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| # Building Windows only for now | |
| # TODO: Uncomment macOS and Linux when ready | |
| os: [windows-latest] | |
| # os: [macos-latest, ubuntu-latest, windows-latest] | |
| include: | |
| # - os: macos-latest | |
| # platform: mac | |
| # - os: ubuntu-latest | |
| # platform: linux | |
| - os: windows-latest | |
| platform: win | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: npm run build | |
| - name: Build installer for ${{ matrix.platform }} | |
| run: npm run dist:${{ matrix.platform }} | |
| - name: List release files (macOS/Linux) | |
| if: matrix.os != 'windows-latest' | |
| run: ls -lh release/ | |
| - name: List release files (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: dir release\ | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-${{ matrix.platform }} | |
| path: | | |
| release/*.dmg | |
| release/*.zip | |
| release/*.AppImage | |
| release/*.deb | |
| release/*.exe | |
| retention-days: 5 | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts/ | |
| - name: Prepare release files | |
| run: | | |
| mkdir -p release-files | |
| find artifacts -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.AppImage" -o -name "*.deb" -o -name "*.exe" \) -exec cp {} release-files/ \; | |
| ls -lh release-files/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.get_version.outputs.version }} | |
| name: Release v${{ steps.get_version.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| body: | | |
| ## Prompt Evaluator v${{ steps.get_version.outputs.version }} | |
| A powerful desktop GUI application for building, running, and analyzing [Promptfoo](https://promptfoo.dev) LLM evaluations. | |
| ### Downloads | |
| **macOS:** | |
| - `.dmg` - Drag and drop installer | |
| - `.zip` - Portable archive | |
| **Windows:** | |
| - `.exe` - Windows installer (NSIS) | |
| - `.zip` - Portable archive | |
| **Linux:** | |
| - `.AppImage` - Universal Linux package (make executable with `chmod +x`) | |
| - `.deb` - Debian/Ubuntu package | |
| ### Installation Notes | |
| **macOS:** You may need to allow the app in System Preferences > Security & Privacy if you see a Gatekeeper warning. | |
| **Linux:** For AppImage, run: | |
| ```bash | |
| chmod +x Prompt-Evaluator-*.AppImage | |
| ./Prompt-Evaluator-*.AppImage | |
| ``` | |
| ### What's New | |
| See the full changelog in the release notes below. | |
| files: release-files/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |