First Test Release #1
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: Build and Release | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python dependencies | |
| run: | | |
| cd backend | |
| pip install -r requirements.txt | |
| - name: Run backend tests | |
| run: | | |
| cd backend | |
| python -m pytest tests/ -v | |
| - name: Run post-install script | |
| run: | | |
| cd backend | |
| python scripts/post_install.py | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Run frontend tests | |
| run: | | |
| cd frontend | |
| npm run test:ci | |
| build-docker: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build backend image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./backend | |
| push: false | |
| tags: nodebook-backend:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Build frontend image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./frontend | |
| push: false | |
| tags: nodebook-frontend:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Upload Docker images | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docker-images | |
| path: | | |
| nodebook-backend:latest | |
| nodebook-frontend:latest | |
| retention-days: 30 | |
| build-electron: | |
| needs: test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| - name: Install Electron dependencies | |
| run: | | |
| cd electron | |
| npm ci | |
| - name: Build Electron package | |
| run: | | |
| cd electron | |
| npm run dist | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload Electron packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: electron-packages-${{ matrix.os }} | |
| path: electron/dist/ | |
| retention-days: 30 | |
| release: | |
| needs: [build-docker, build-electron] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Docker images | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: docker-images | |
| path: ./ | |
| - name: Download Electron packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: electron-packages-ubuntu-latest | |
| path: ./electron/dist/ | |
| - name: Create release assets | |
| run: | | |
| mkdir -p releases/v${{ github.event.release.tag_name }} | |
| cp -r electron/dist/* releases/v${{ github.event.release.tag_name }}/ | |
| # Create deployment script | |
| cat > releases/v${{ github.event.release.tag_name }}/deploy-docker.sh << 'EOF' | |
| #!/bin/bash | |
| echo "🐳 Deploying NodeBook with Docker..." | |
| docker-compose up -d | |
| echo "✅ NodeBook deployed successfully!" | |
| echo "Access the application at: http://localhost:3000" | |
| EOF | |
| chmod +x releases/v${{ github.event.release.tag_name }}/deploy-docker.sh | |
| - name: Upload release assets | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ github.event.release.upload_url }} | |
| asset_path: ./releases/v${{ github.event.release.tag_name }}/ | |
| asset_name: nodebook-v${{ github.event.release.tag_name }} | |
| asset_content_type: application/zip |