name: Build, Lint, and Deploy Arctic Species Portal on: push: branches: - main # Or your primary branch, e.g., master pull_request: # Also run on pull requests to main branches: - main jobs: test-and-build: # Renamed job for clarity runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' - name: Install dependencies run: npm install - name: Lint project run: npm run lint # Runs your ESLint command - name: Build project run: npm run build # Runs tsc && vite build # This will also catch TypeScript errors - name: List output files # Optional: just to see build output in logs if: success() # Only run if build succeeds run: | echo "Build completed. Output files in dist/:" ls -R dist deploy: # New job for deployment, depends on test-and-build needs: test-and-build # Ensures this job runs only if test-and-build succeeds if: gitea.event_name == 'push' && gitea.ref_name == 'main' # Corrected for Gitea runs-on: ubuntu-latest steps: # We need to checkout and build again, or pass artifacts # For simplicity in this example, let's re-checkout and re-build # A more advanced setup would pass 'dist' as an artifact from the 'test-and-build' job - name: Checkout repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: '20' - name: Install dependencies run: npm install - name: Build project run: npm run build # Ensure the production assets are built for deployment - name: Deploy to Production (Placeholder) run: | echo "Deployment step: Replace this with your actual deployment commands." echo "Files from 'dist/' are ready for deployment." # Example for copying to a server (requires SSH setup): # scp -r dist/* user@yourserver:/var/www/your-project-path/ # Or using rsync: # rsync -avz dist/ user@yourserver:/var/www/your-project-path/