feat: implement user profile dropdown and settings page #45
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: Deploy to profullstack Server | |
| on: | |
| push: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to deploy to' | |
| required: true | |
| default: 'production' | |
| type: choice | |
| options: | |
| - production | |
| - staging | |
| env: | |
| NODE_VERSION: '20' | |
| SERVER_HOST: 'profullstack' | |
| SERVER_USER: 'ubuntu' | |
| APP_DIR: '/home/ubuntu/www/launchpadder.com/launchpadder-web' | |
| jobs: | |
| # Code Quality and Security Checks | |
| quality-checks: | |
| name: Code Quality & Security | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: latest | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run ESLint | |
| run: pnpm run lint | |
| - name: Run Prettier check | |
| run: pnpm run format:check | |
| - name: Security audit | |
| run: pnpm audit --audit-level moderate | |
| # Run Tests | |
| test: | |
| name: Test Suite | |
| runs-on: ubuntu-latest | |
| needs: quality-checks | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: test_db | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| redis: | |
| image: redis:7-alpine | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: latest | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Setup test environment | |
| run: | | |
| cp .env.test.example .env.test | |
| echo "TEST_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/test_db" >> .env.test | |
| echo "REDIS_URL=redis://localhost:6379/1" >> .env.test | |
| - name: Run tests | |
| run: pnpm run test:all | |
| env: | |
| NODE_ENV: test | |
| # Deploy to profullstack Server | |
| deploy: | |
| name: Deploy to profullstack | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup SSH | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.PROFULLSTACK_SSH_KEY }} | |
| - name: Add server to known hosts | |
| run: | | |
| ssh-keyscan -H ${{ env.SERVER_HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy to profullstack server | |
| run: | | |
| ssh ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }} << 'EOF' | |
| set -e | |
| echo "🚀 Starting deployment to profullstack..." | |
| # Navigate to application directory | |
| cd ${{ env.APP_DIR }} | |
| # Pull latest code | |
| echo "📦 Pulling latest code..." | |
| git fetch origin | |
| git reset --hard origin/main | |
| # Make deployment script executable | |
| chmod +x scripts/*.sh | |
| # Run custom deployment script | |
| echo "🔧 Running deployment script..." | |
| APP_PORT=${{ secrets.APP_PORT || '3000' }} \ | |
| DOMAIN=${{ secrets.DOMAIN || 'launchpadder.com' }} \ | |
| SETUP_NGINX=${{ secrets.SETUP_NGINX || 'false' }} \ | |
| ./scripts/deploy-to-profullstack.sh | |
| EOF | |
| - name: Health check | |
| run: | | |
| echo "🏥 Performing health check..." | |
| sleep 30 | |
| ssh ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }} << 'EOF' | |
| curl -f http://localhost:${{ secrets.APP_PORT || '3000' }}/api/health || exit 1 | |
| echo "✅ Health check passed!" | |
| EOF | |
| - name: Display deployment info | |
| run: | | |
| echo "🎉 Deployment completed successfully!" | |
| echo "📍 Server: ${{ env.SERVER_HOST }}" | |
| echo "📁 Directory: ${{ env.APP_DIR }}" | |
| echo "🌐 Domain: ${{ secrets.DOMAIN || 'launchpadder.com' }}" | |
| echo "🔌 Port: ${{ secrets.APP_PORT || '3000' }}" | |
| - name: Notify deployment failure | |
| if: failure() | |
| run: | | |
| echo "❌ Deployment failed! Checking logs..." | |
| ssh ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }} << 'EOF' | |
| cd ${{ env.APP_DIR }} | |
| echo "📋 PM2 Status:" | |
| pm2 status || true | |
| echo "📝 Recent logs:" | |
| pm2 logs launchpadder --lines 20 || true | |
| EOF | |
| # Optional: Slack notification | |
| notify: | |
| name: Notify Deployment | |
| runs-on: ubuntu-latest | |
| needs: deploy | |
| if: always() && (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch') | |
| steps: | |
| - name: Slack notification | |
| uses: 8398a7/action-slack@v3 | |
| with: | |
| status: ${{ needs.deploy.result }} | |
| channel: '#deployments' | |
| text: | | |
| 🚀 LaunchPadder Deployment to profullstack | |
| Status: ${{ needs.deploy.result }} | |
| Branch: ${{ github.ref_name }} | |
| Commit: ${{ github.sha }} | |
| Domain: ${{ secrets.DOMAIN || 'launchpadder.com' }} | |
| Server: profullstack | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
| if: env.SLACK_WEBHOOK != '' |