feat: add github action #2
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 Deploy Static Export | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: ['*'] | |
| pull_request_target: | |
| types: [closed] | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' # Updated to match project's Node version requirements | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build static export | |
| run: npm run build # This will run next build which generates the 'out' directory | |
| - name: Deploy to FTP | |
| if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true | |
| uses: SamKirkland/FTP-Deploy-Action@4.3.0 | |
| with: | |
| server: ${{ secrets.FTP_HOST }} | |
| username: ${{ secrets.FTP_USERNAME }} | |
| password: ${{ secrets.FTP_PASSWORD }} | |
| local-dir: ./out/ | |
| # Update this to your target directory on the FTP server | |
| server-dir: / # Change this to your desired directory path on the server | |