name: Deploy to Production on: push: branches: [main] pull_request: branches: [main] jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: Install dependencies run: npm ci - name: Build run: npm run build env: ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} - name: Upload build artifact if: github.ref == 'refs/heads/main' && github.event_name == 'push' uses: actions/upload-artifact@v4 with: name: build path: build/ retention-days: 1 deploy: name: Deploy needs: build runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Download build artifact uses: actions/download-artifact@v4 with: name: build path: build/ - name: Deploy via FTP uses: SamKirkland/FTP-Deploy-Action@v4.3.5 with: server: ${{ secrets.FTP_SERVER }} username: ${{ secrets.FTP_USER }} password: ${{ secrets.FTP_PWD }} local-dir: ./build/ server-dir: code-docs/www/